Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#46 Saffith

Saffith

    IPv7 user

  • Members

Posted 24 January 2014 - 10:10 AM

There isn't a function like that, but you could do it with an extended font.
A function shouldn't be hard to add, but I'm not sure how the spacing would work.

#47 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 March 2014 - 02:55 PM

Hi Saffith,

 

Now that I am back to working on my project, I am re-examining Tango:

 

Is there any chance on menu and subment functions, that work without needing many custom draw commands, to make the typical, black box menus found in most old JRPGs?

 

I think this would be an excellent addition, as I had mentioned a while back. Something in line with this:

 

tango_main_menu(position, width, height, font, frame, cursor, bg_colour, opacity, text_colour, frame_colour, select_button, exit_button, cursor_sound, close_sound, menu_index)

This draws the menu box. It can be on-screen at all times, or called with an item, or other function.

 

position: Sets the position of menu box, starting with upper-leftmost pixel.

width: Sets width of box, in pixels.

height: Sets height of box, in pixels.

font: Sets default font. If font value is set in menu_option, this overrides font setting for menu, for that option only.

frame: sets of frame is true, or false, and if true, how thick (in pixels) the border will be. A frame of 0 is 'no frame'.

cursor: sets marker tile, for arrow next to selection

bg_colour: sets bg colour of box; 0 is black

opacity: Sets opacity of bg_colour

text_colour: Sets default font text colour using ZC colour codes.

frame_colour: Sets colour of frame

select_button: When menu is active, this button activates a selection.

exit_button: When menu is active, this button closes menu.

cursor_sound: Sound to play when moving cursor.

close_sound: Sound to play when closing/exiting menu.

menu_index: This is an index number for this menu, to be used when calling this function, to allow ZC to know what menu to call.

 

 

tango_menu_option(text, font, text_colour, menu_entry_number, up_next, down_next, left_next, right_next, select_button, activate_sound, autoclose)

This adds a menu option using the text provided. The actual function of this option must be supplied.

text: This is the actual text displayed for the entry in the menu.

font: If set, use this font in place of default font for menu or sub-menu.

text_colour: if set, use this in place of the default text_colour for menu or submenu.

menu_entry_number: This is an index number, tied to the menu entry, for use as a pointer.

up_next: Move cursor to the pointer (menu_entry_number) assigned to this, if UP button is pressed.

down_next: Move cursor to the pointer (menu_entry_number) assigned to this, if DOWN button is pressed.

left_next: Move cursor to the pointer (menu_entry_number) assigned to this, if LEFT button is pressed.

right_next: Move cursor to the pointer (menu_entry_number) assigned to this, if RIGHT button is pressed.

select_button: execute functions assigned to this menu item if this button is pressed.

activate_sound: Sound to play when activating menu item.

autoclose: CLose this, or all menus, after activating menu item. (0 none, 1, this menu or submenu, 2, all menus)

 

tango_submenu(position, width, height, font, frame, marker, bg_colour, opacity, text_colour, frame_colour, select_button, exit_button, close_all, return_to, cursor_sound, close_sound, menu_index)

This provides a menu_option with text, that when activated, creates a new menu, with its own menu_option list. The flow of submenus can cascade multiple times, so each new tango_submenu would call a new menu. The variables use the same format as tango_menu, and tango_menu_option, with this addition:

 

close_all: When the sub-menu box is open, does using the close button close all menus, or only this submenu

return_to: sets menu to return to, if close_all is set to 0 (no)

 

gfx_menu(position, width, height, font, label_x_position, label_y_position, label_font, frame, marker, bg_colour, opacity, bg_screen, frame_colour, select_button, exit_button, close_all, return_to, cursor_sound, close_sound, menu_index)

This is a graphical menu, like the subscreen. It would use a graphical cursor, and tiles, for menu items, instead of text. The different functions here are:

 

label_x_position: Draws a label, in text, using text from selected menu item (x-position, starting with upper-leftmost pixel)

label_y_position: Draws a label, in text, using text from selected menu item (y-position, starting with upper-leftmost pixel)

label_font: Font to use for labels.

marker: Sets tile to use as cursor, which is overlaid on menu item.

bg_screen: Uses a screen as a background imae, via drawscreen and drawlayer commands.

menu_index: The index number of this menu, to use for calling it with other functions.

 

gfx_menu_item(combo, x_position, y_position, width, height, label, name, menu_entry_number, up_next, down_next, left_next, right_next, select_button, activate_sound, autoclose, load_menu, swap_button, swap_to, open_menu, close_first)

Uses a tile for a gfx_menu, like the subscreen.

 

combo: Sets combo to use.

x_position: X position of combo, starting with upper-left pixel.

y-position: Y position of combo, starting with upper-left pixel.

label: Sets name to display (as text) for label.

load_menu: Loads other menu, when activating this menu entry.

swap_button: Changes the menu to another when pressing specified button.

swap_to: Sets menu to swap to when using swap button.

open_menu: Opens a menu (using index number) when activating this entry.

close_first: If open_menu is used, does the current menu close, or is the new menu drawn over it? () for keep open, 1 for close). This would, as an example, allow you to open a small gfx menu on-top of the bigger menu, like the bottles submenu in LttP/TotG; or a text menu, on-top of a gfx menu, which would be great for inventory control of counter-based items.

 

These two gfx_menu functions would allow easily-built custom subscreens, including multiple subscreens (using a left/right gfx_menu_item).

 

Update: I am putting a $100 BOUNTY on these functions for Tango.


Edited by ZoriaRPG, 08 March 2014 - 03:20 PM.


#48 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 10 March 2014 - 05:54 PM

You can actually use custom functions for those.
 
edit: You'll also need to increase the number of arguments. I forget how but it's in function.zh need to edit some numbers and array sizes to fit your needs. ;)

edit2: Straight from PM box. enjoy. :)
 

I was thinking I'd just increase the number of arguments available. The limit is entirely arbitrary. If you want to do that yourself, it's just a small edit in functions.zh. Change the array size on line 196 and the same number on line 213.


Edited by Zecora, 10 March 2014 - 06:07 PM.


#49 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 12 March 2014 - 09:41 PM

ffc script TangoAutoString
{
    void run(int message, bool warp, int warpscreen)
    {
        int slot = ShowMessageByLink(message, TANGO_SLOT_NORMAL);
        while(Tango_SlotIsActive(slot))
            Waitframe();
        if(warp)
            Link->Warp(Game->GetCurDMap(), warpscreen);
    }
}

This doesn't work at all. :(

Not sure why either. Style is set up and everything.

 

Figured it out, had to throw in a wait frame at the beginning.


Edited by Zecora, 13 March 2014 - 11:47 AM.


#50 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 14 March 2014 - 02:31 PM

How do we implement the flag TANGO_FLAG_FREEZE_SCREEN?

 

Found the functions that it uses. For those who also want to make use of this it's located in tango.zh


Edited by Zecora, 15 March 2014 - 11:32 AM.


#51 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 14 April 2014 - 12:30 PM

what's the syntax for @if

I'm using @if(@zstring5(itemID) @goto(stringNum)) and get errors 3 and 7



#52 Saffith

Saffith

    IPv7 user

  • Members

Posted 28 May 2014 - 04:52 PM

Finally, another update. Sorry it's taken so long.
This will invalidate existing saved games.
  • Added optional support for string control codes
  • Added functions to save and restore state
  • Added functions to suspend a text slot indefinitely
  • Functions can take up to four arguments now
  • @domenu() takes a second argument specifying the initially selected choice
  • Several bug fixes
In addition, there's a new file included: tangoQuickStart.zh. This serves as both an easy way to try using Tango and a simple example of how to set it up.

There haven't been any big compatibility breaking changes. @domenu() no longer adds a line break automatically; I think that's the only thing you might have to update for.

There are a few more things I'd like to add, but they can wait until after 1.0. For now, I just plan to fix bugs and clean up.



ZoriaRPG, you can make proper cascading menus now. Here's an example: https://www.dropbox....fooii7/menu.zip
Press A to open the menu. "Magic" is the only interesting one.
General idea: Build strings that display menus and then suspend. Save the state while the menu's running, leave it suspended while the submenu runs, then restore the state or clear the slot depending on what the submenu does.

#53 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 28 May 2014 - 10:03 PM

Finally, another update. Sorry it's taken so long.
This will invalidate existing saved games.

  • Added optional support for string control codes
  • Added functions to save and restore state
  • Added functions to suspend a text slot indefinitely
  • Functions can take up to four arguments now
  • @domenu() takes a second argument specifying the initially selected choice
  • Several bug fixes
In addition, there's a new file included: tangoQuickStart.zh. This serves as both an easy way to try using Tango and a simple example of how to set it up.

There haven't been any big compatibility breaking changes. @domenu() no longer adds a line break automatically; I think that's the only thing you might have to update for.

There are a few more things I'd like to add, but they can wait until after 1.0. For now, I just plan to fix bugs and clean up.



ZoriaRPG, you can make proper cascading menus now. Here's an example: https://www.dropbox....fooii7/menu.zip
Press A to open the menu. "Magic" is the only interesting one.
General idea: Build strings that display menus and then suspend. Save the state while the menu's running, leave it suspended while the submenu runs, then restore the state or clear the slot depending on what the submenu does.

 

 

 

This is brilliant!

 

I've integrated it, and set up some basic functions, although I have two questions:

 

Increasing Slot Count

 

I modified the field size of this field:

 

const int __TANGO_NUM_SLOTS = 5;
int __Tango_SlotData[85]; // __TANGO_SIZEOF_DATA * __TANGO_NUM_SLOTS
                            // __TANGO_SIZEOF_DATA is currently 17
 

 

...and I set additional constants for SLOT_4 and SLOT_5, but that clearly isn't sufficient. Is the slot count capped at three because of any special limitation?

 

I know that expanding the slot count isn't as simple as what I've done, as trying to load, or use SLOT_4 makes Tango very unhappy. (i.e. Graphical corruption.)

 

 

Second, I'm guessing that it's in the documentation, but is there a function (or argument) to locate menus at specified coordinates?

 

Otherwise, I now need to write FFCs to work with functions through the menus. That's going to be a bit tricky for some things, but easy-peasy for others.

 

Send me a PM if you're claiming the bounty.



#54 Saffith

Saffith

    IPv7 user

  • Members

Posted 28 May 2014 - 10:35 PM

const int __TANGO_NUM_SLOTS = 5;
int __Tango_SlotData[85]; // __TANGO_SIZEOF_DATA * __TANGO_NUM_SLOTS
                            // __TANGO_SIZEOF_DATA is currently 17
 
 
...and I set additional constants for SLOT_4 and SLOT_5, but that clearly isn't sufficient. Is the slot count capped at three because of any special limitation?
 
I know that expanding the slot count isn't as simple as what I've done, as trying to load, or use SLOT_4 makes Tango very unhappy. (i.e. Graphical corruption.)

You also have to add more definitions to __Tango_SlotDefs[] and increase the size of __Tango_Buffer[]. What you've got there is out of date, incidentally; __TANGO_SIZEOF_DATA is 18 now.
 
 

Second, I'm guessing that it's in the documentation, but is there a function (or argument) to locate menus at specified coordinates?
 
Otherwise, I now need to write FFCs to work with functions through the menus. That's going to be a bit tricky for some things, but easy-peasy for others.

If they're regular strings, like I used, you can position them with Tango_SetSlotPosition(). You can also @set() @x and @y. I haven't tested that with menus, though; I'm sure it'll work if you do it before adding any @choices, but it might be buggy after.

#55 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 28 May 2014 - 11:45 PM

You also have to add more definitions to __Tango_SlotDefs[] and increase the size of __Tango_Buffer[]. What you've got there is out of date, incidentally; __TANGO_SIZEOF_DATA is 18 now.

 
I'll look for those other entries, and see if I can figure out what's going on with them. I doubt that I'd need more than five slots, in any event, for cascading menus. The deep cascades are Skills-> Items-> and Spells->, as each has sub-categories, with final selections.

 

Am  I missing something with SlotDefs?

int __Tango_SlotDefs[] = {
    // 0
    TANGO_SLOT_WINDOW,
    0,        // Starting index in __Tango_StringBuffer
    256,      // Maximum length after processing
    0, 0,     // X, Y on offscreen bitmap
    256, 176, // Width, height on offscreen bitmap
    
    // 1
    TANGO_SLOT_WINDOW,
    512,
    256,
    256, 0,
    256, 176,
    
    TANGO_SLOT_WINDOW,
    512,
    256,
    0, 176,
    256, 176
};

What is the difference between the main seven elemebts, and the other two sets? I'm not sure what drawing the off-screen bitmap is doing here, and why the starting index is increased to 512, but not to 256.

 

Do I need to edit these at all, or need I just set the buffer size to 1280 (256 * 5)?

 

 

 

 

Items->, and Skills-> may need six slots. That depends on how I sort the lists, and how other fonts work. I expect that if I use a smaller font, i can fit more on a list, and therefore require fewer panels.

 

I could also use a handy way to cause one menu to replace the one that existed before it. (I assume that's a standard option too; or rather, the standard method of using slots.)

 

As an example, selecting Spells, then Selecting a category, could open a menu replacing the spell category list, with a list of spells that belong to that category. I'm on the fence on this, for one way avoids the slot problem, and uses less space; whilst the other affords the player more easy navigation.

 

If they're regular strings, like I used, you can position them with Tango_SetSlotPosition(). You can also @set() @x and @y. I haven't tested that with menus, though; I'm sure it'll work if you do it before adding any @choices, but it might be buggy after.


I wasn't specific here, or else, I don;t understand how the draw functions are working. What I'd like to set, is the window/frame position, on the screen (X/Y start). is that set through the string itself?

I'll look at that function too.

One major problem, is that opening a menu doesn't freeze action on the screen. (Enemies still move, timer counters still count, etc..) What would be the best way for a menu to interrupt all other action, until all menus are closed?

 

I assume this would also apply to other string functions, and I don't think you want messages to appear, allowing the player to be killed while reading them.

 

Edit:

I found the flag, TANGO_FLAG_FREEZE_SCREEN, but I don't know what function sets it, or the syntax to set it. is it a Tango Style Attribute, or some other Set type? I'm assuming that enabling this while the manu is active would solve this problem.

 

(Else, is this just a fault in the menus code, because I didn't add a FREEZE_ACTION type function to them?)

e.g. At present, it's pretty easy to be killed while trying to select a spell.

 

I also noticed some odd compiler behaviour, when trying to add additional bool functions, like bool doMagic(). I added bool fireSpells(), in an almost identical manner to doMagic(), and I received a 'cannot cast from bool to float' error. I fixed this, by changing some parameters, and this is what the function looks like with those changes, for reference:

 

 

Perhaps using a bool as a function in the way that you do with (this below) can't cascade?

 

Works from main menu function:

            else if(choice==4) // Magic
                done=DoMagic();
                
            else if (Link->PressEx1){
                done = true;
            }
            else
                done=true;
           

Does not work from DoMagic() :

            else if(choice==4) // Magic
                done=fireSpells();
                
            else if (Link->PressEx1){
                done = true;
            }
            else
                done=true;
           
 

Does work from DoMagic() :

  else if(choice == 4){
            fireSpells();
            }
            
        else if (Link->PressEx1){
                done = 2;
        }
        else
            done=2;

I don't know why done = works in one segment, and not the other, but I can use direct calls. I sense another consistency problem here, or else, I don't understand the nature of the error.


Edited by ZoriaRPG, 29 May 2014 - 12:01 AM.


#56 Saffith

Saffith

    IPv7 user

  • Members

Posted 29 May 2014 - 12:31 AM

What is the difference between the main seven elemebts, and the other two sets?

Sorry, I was pretty sloppy there. The second and third sets are the same thing for slots 1 and 2, except they should have the numbers set so they don't overlap in the buffer or bitmap.
 

I'm not sure what drawing the off-screen bitmap is doing here,

Text is rendered there and copied to the screen later. The bitmaps are 512x512, so you'll have to allocate a bit less space if you want five or six slots. They're set to be a full screen, but they only need to be as big enough to contain the longest string's text.
 

and why the starting index is increased to 512, but not to 256.
 
Do I need to edit these at all, or need I just set the buffer size to 1280 (256 * 5)?

That was a mistake. It happens that it doesn't cause problems in this case, but it normally would. The buffer does need to be size 1280 for five 256-character slots.
 

I could also use a handy way to cause one menu to replace the one that existed before it. (I assume that's a standard option too; or rather, the standard method of using slots.)

As long as you clear the slot before setting up the replacement menu, it'll be available for Tango_GetFreeSlot() to grab.
 

I wasn't specific here, or else, I don;t understand how the draw functions are working. What I'd like to set, is the window/frame position, on the screen (X/Y start). is that set through the string itself?

Yes, strings are able to reposition themselves. See the "Item obtained" message in the demo, for instance.
 

I found the flag, TANGO_FLAG_FREEZE_SCREEN, but I don't know what function sets it, or the syntax to set it. is it a Tango Style Attribute, or some other Set type? I'm assuming that enabling this while the manu is active would solve this problem.

It's a style attribute.
Tango_SetStyleAttribute(style, TANGO_STYLE_FLAGS, TANGO_FLAG_FREEZE_SCREEN);
You'll have to add implementations for the freeze and unfreeze functions in the main file. I'd suggest reserving two FFCs to use as screen freeze combos, and you'll probably need SuspendGhostZHScripts().
 

I also noticed some odd compiler behaviour, when trying to add additional bool functions, like bool doMagic(). I added bool fireSpells(), in an almost identical manner to doMagic(), and I received a 'cannot cast from bool to float' error.

I wasn't entirely consistent with that. done is an int in that function. 0: don't close the menu, 1: close the current menu and the parent, 2: close the current menu but not the parent.
If you're planning to use it more or less as-is, you might want to come up with constants for those.

#57 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 29 May 2014 - 01:59 AM

Sorry, I was pretty sloppy there. The second and third sets are the same thing for slots 1 and 2, except they should have the numbers set so they don't overlap in the buffer or bitmap.


I actually did figure out what you had going on there. The lack of annotation, was just an oversight. it took me a while to realise what you were doing, but when I remembered that Tango was using graphic drawing, and never used internal text, it dawned on me that these are overscan coordinates for those graphics.

This is how I assigned the 'slots':



I'm not sure if these will overlap, or if I'm safe.

What is the maximum overscan/pan range in X and Y directions, and is it only a positive value, or are negative values also valid target coordinates?
 

Text is rendered there and copied to the screen later. The bitmaps are 512x512, so you'll have to allocate a bit less space if you want five or six slots. They're set to be a full screen, but they only need to be as big enough to contain the longest string's text.


I had forgotten that quirk. I should probably draw a map of the areas that I'm using, but I don't know what the maximum ranges are for values outside the normal screen space.
 

That was a mistake. It happens that it doesn't cause problems in this case, but it normally would. The buffer does need to be size 1280 for five 256-character slots.


That's how I set it up. At present, I have five working slots, that seem to be doing their job, but I haven't made enough to determine what will over-write what else.
 

As long as you clear the slot before setting up the replacement menu, it'll be available for Tango_GetFreeSlot() to grab.


Does that function latch onto the lowest free slot, highest free slot, or ???

Do I understand rightly, that if I don't declare a slot as a target, that using that function, will use whatever slot is available? I'm not sure if I should be targeting slots directly; or if that's even intended.
 

Yes, strings are able to reposition themselves. See the "Item obtained" message in the demo, for instance.


I'll read more of the docs on that. The screen freezing problem is now my primary concern...
 
 

It's a style attribute.

Tango_SetStyleAttribute(style, TANGO_STYLE_FLAGS, TANGO_FLAG_FREEZE_SCREEN);
You'll have to add implementations for the freeze and unfreeze functions in the main file. I'd suggest reserving two FFCs to use as screen freeze combos, and you'll probably need SuspendGhostZHScripts().

 


Right'o... Do I understand correctly, that although this flag exists, it doesn't actually do anything at present?

I tried to set that style type, in a few places, and even called it directly, to no avail.

 

Do you already have FFCs ready that cause this to happen, so that the player can interact with the menus (and other dialogue boxes) safely?

I expect that SuspendGhostZHScripts is a function to do exactly that, with a reverse (resume) function, that I would call in the FFC scripts to freeze the screen?

This is what I put in the menu code:



I placed Tango_SetStyleAttribute(WINDOW_SLOT_1, TANGO_STYLE_FLAGS, TANGO_FLAG_FREEZE_SCREEN) in the while loop there; and I also set it as a style attribute in the function



Am I using it improperly, or do I just need to set up something that actually causes the freeze effect to happen?

Assuming the latter, if you already have code for that, it could be useful; and I'd suggest making it part of the Tango header, as it's pretty essential to its operation.

 

(I'd also suggest TANGO_STYLE_MENU_ERROR_SFX, which I pre-defined in my copy of Tango, and was planning to set up; but that isn't anywhere near as important.)
 

I wasn't entirely consistent with that. done is an int in that function. 0: don't close the menu, 1: close the current menu and the parent, 2: close the current menu but not the parent.
If you're planning to use it more or less as-is, you might want to come up with constants for those.


No worries. I'll probably refine it over time, but I doubt I'd need to spend constants there. As long as I have a reference 0 = false, 1 = true, 2 = something else, etc., I'm fine. It's pretty much impossible to establish a constant for everything... I may make one set of them at some point, each equating to a specific state, but that would need to be shared outside of the menu system.

(If a value is only useful in a limited scope, I generally avoid setting a constant; as I don;t have an unlimited quantity available.)

 

One other minor quirk to note:

 

While pressing A does select menu options, it can also use items, and not operate the menu. This is timing based, and I'm not sure how best to approach fixing it, aside from assigning the menu buttons to move forward, or back, to other buttons. (Actually, I expect that if I could freeze the screen, this problem would also go away.)


Edited by ZoriaRPG, 29 May 2014 - 02:05 AM.


#58 Saffith

Saffith

    IPv7 user

  • Members

Posted 29 May 2014 - 09:16 AM

I'm not sure if these will overlap, or if I'm safe.

Slot 1's starting index should be 256, and slot 4 overlaps 2 in the bitmap. You'll need to reduce each one's bitmap size a bit to fit them all; 256x168 should do.

What is the maximum overscan/pan range in X and Y directions, and is it only a positive value, or are negative values also valid target coordinates?

For the bitmaps, valid coordinates are 0-511 on each axis. That's the only restriction. If you mean screen coordinates, there's no limit.

Does that function latch onto the lowest free slot, highest free slot, or ???

Lowest. Better not to depend on that if you can help it, though.

Do I understand rightly, that if I don't declare a slot as a target, that using that function, will use whatever slot is available? I'm not sure if I should be targeting slots directly; or if that's even intended.

That's right. You can do it either way, getting slots automatically or managing them yourself. In this case, the latter would be perfectly reasonable. Each menu can just open the next submenu in its own slot +1.

I expect that SuspendGhostZHScripts is a function to do exactly that, with a reverse (resume) function, that I would call in the FFC scripts to freeze the screen?

Yes.

I placed Tango_SetStyleAttribute(WINDOW_SLOT_1, TANGO_STYLE_FLAGS, TANGO_FLAG_FREEZE_SCREEN) in the while loop there; and I also set it as a style attribute in the function

No need for a loop. It's persistent, so it can go in the one-time setup function.

Am I using it improperly, or do I just need to set up something that actually causes the freeze effect to happen?

Assuming the latter, if you already have code for that, it could be useful; and I'd suggest making it part of the Tango header, as it's pretty essential to its operation.

I'm doing it this way in my quest:
const int FFC_FREEZE_1 = 31;const int FFC_FREEZE_2 = 32;const int SCREEN_FREEZE_COMBO_1 = 14898;const int SCREEN_FREEZE_COMBO_2 = 14899;void __Tango_FreezeScreen(){    ffc freezer=Screen->LoadFFC(FFC_FREEZE_1);    freezer->Data=SCREEN_FREEZE_COMBO_1;    freezer=Screen->LoadFFC(FFC_FREEZE_2);    freezer->Data=SCREEN_FREEZE_COMBO_2;    SuspendGhostZHScripts();}void __Tango_UnfreezeScreen(){    ffc freezer=Screen->LoadFFC(FFC_FREEZE_1);    freezer->Data=0;    freezer=Screen->LoadFFC(FFC_FREEZE_2);    freezer->Data=0;    ResumeGhostZHScripts();}
Where combos 14898 and 14899 are blank combos of types Screen Freeze (Except FFCs) and Screen Freeze (FFCs Only). They don't need scripts. If you do that, be sure to set AUTOGHOST_MIN/MAX_FFC and FFCS_MIN/MAX_FFC to exclude the ones you use.

Except you actually need FFCs to run, don't you? It's more work, but you could do this instead of using the FFC freeze combo:
// Set this to true or false to suspend and resume scripts.// Be sure to set it to false at the start of the global script.bool ffcsSuspended;// Use this instead of Waitframe() in any FFCs you want to be able to suspend.void FFCWaitframe(){    do    {        Waitframe();    } while(ffcsSuspended);}
The reason those functions are empty by default is that there's no reasonable default implementation. No major tileset comes with invisible screen freeze combos set up, and even if they did, those may not be sufficient. And messing with two random FFCs could cause serious problems.

While pressing A does select menu options, it can also use items, and not operate the menu. This is timing based, and I'm not sure how best to approach fixing it, aside from assigning the menu buttons to move forward, or back, to other buttons. (Actually, I expect that if I could freeze the screen, this problem would also go away.)

Yeah, freezing should fix that.

#59 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 29 May 2014 - 04:57 PM

Slot 1's starting index should be 256, and slot 4 overlaps 2 in the bitmap. You'll need to reduce each one's bitmap size a bit to fit them all; 256x168 should do.

For the bitmaps, valid coordinates are 0-511 on each axis. That's the only restriction. If you mean screen coordinates, there's no limit.

Lowest. Better not to depend on that if you can help it, though.

That's right. You can do it either way, getting slots automatically or managing them yourself. In this case, the latter would be perfectly reasonable. Each menu can just open the next submenu in its own slot +1.

Yes.

No need for a loop. It's persistent, so it can go in the one-time setup function.

I'm doing it this way in my quest:

const int FFC_FREEZE_1 = 31;const int FFC_FREEZE_2 = 32;const int SCREEN_FREEZE_COMBO_1 = 14898;const int SCREEN_FREEZE_COMBO_2 = 14899;void __Tango_FreezeScreen(){    ffc freezer=Screen->LoadFFC(FFC_FREEZE_1);    freezer->Data=SCREEN_FREEZE_COMBO_1;    freezer=Screen->LoadFFC(FFC_FREEZE_2);    freezer->Data=SCREEN_FREEZE_COMBO_2;    SuspendGhostZHScripts();}void __Tango_UnfreezeScreen(){    ffc freezer=Screen->LoadFFC(FFC_FREEZE_1);    freezer->Data=0;    freezer=Screen->LoadFFC(FFC_FREEZE_2);    freezer->Data=0;    ResumeGhostZHScripts();}
Where combos 14898 and 14899 are blank combos of types Screen Freeze (Except FFCs) and Screen Freeze (FFCs Only). They don't need scripts. If you do that, be sure to set AUTOGHOST_MIN/MAX_FFC and FFCS_MIN/MAX_FFC to exclude the ones you use.

Except you actually need FFCs to run, don't you? It's more work, but you could do this instead of using the FFC freeze combo:
// Set this to true or false to suspend and resume scripts.// Be sure to set it to false at the start of the global script.bool ffcsSuspended;// Use this instead of Waitframe() in any FFCs you want to be able to suspend.void FFCWaitframe(){    do    {        Waitframe();    } while(ffcsSuspended);}
The reason those functions are empty by default is that there's no reasonable default implementation. No major tileset comes with invisible screen freeze combos set up, and even if they did, those may not be sufficient. And messing with two random FFCs could cause serious problems.

Yeah, freezing should fix that.

 

I'm assuming that I need to draw that combo onto the screen in order to use the effect; or is that combo constant set up somewhere in Tango?

 

I see... Tango will run that FFC in a slot for one of the two effects. In that case, am I just making the FFC draw the combo onto the screen, and does it matter to what layer its drawn?

 

I'm not even sure how these would interact with normal game events, and if they'd interrupt new FFCs from being created. FFCWaitframe should solve that for most FFCs, so I'll need to re-code anything that I'm using with that in mind.

 

I'd think there was a less convoluted way to pause game events; and I don;t think these would affect global timers. I'm going to need to add a bool there too, to pause timers when the menu is active. Ekh...

 

I know that calling an active subscreen causes all events in the game to pause; in fact, you can;t even open a menu when the active subscreen is down.. Is there any way to mimic that kind of general behaviour, with the exception of FFCs?

 

 

(BTW, I do see that this is just changing the extant FFC in a given position, such as Screen->FFC31, to that combo; but wouldnpt running an external FFC script without changing an extant FFC--to ensure that there are always 32 open FFCs to use on a screen--work?)

 

(Else, does FFCScript.zh also use one of those slots?)

Speaking of subscreens. I was also wondering if the pasive subscreen area is a valid draw target by any means, as it would be interesting to spawn specific menus over that area; and I do still need a ref sheet for overscan / screen offsets, with maximum offset coordinates in all four directions (+X, -X, +Y, -Y: I don't know if ZC treats Z as a valid direction for drawing functions of this sort; or if separate layers, that are still bound to a screen, are valid coordinates.)

 

P.S. Does SuspendGhostZHScripts() suspend both ghosted, and autoghosted ghost-related operations?

 

If so, this is what I did:

 

void freezeAction(){
    ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL);
    freezeAll->Data = CMB_FREEZEALL;
    SuspendGhostZHScripts();
}

void unfreezeAction(){
    ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL);
    freezeAll->Data = CMB_BLANK;
    ResumeGhostZHScripts();
}

 

I use ghost.zh for all FFC-based enemies, and most things that can do damage; thus if the player is suspended, and enemies are suspended, I'm not sure why I'd want to freeze all FFCs.


Edited by ZoriaRPG, 29 May 2014 - 06:00 PM.


#60 Saffith

Saffith

    IPv7 user

  • Members

Posted 29 May 2014 - 05:25 PM

I'm assuming that I need to draw that combo onto the screen in order to use the effect; or is that combo constant set up somewhere in Tango?
 
I see... Tango will run that FFC in a slot for one of the two effects. In that case, am I just making the FFC draw the combo onto the screen, and does it matter to what layer its drawn?

It's nothing to do with Tango, just ZC's built-in screen freezing combos. Drawing won't work; the combo has to be used by an actual FFC.
 

I'd think there was a less convoluted way to pause game events; and I don;t think these would affect global timers. I'm going to need to add a bool there too, to pause timers when the menu is active. Ekh...

You could have the global script go into a minimal inner loop while the menu is open.
 

I know that calling an active subscreen causes all events in the game to pause; in fact, you can;t even open a menu when the active subscreen is down.. Is there any way to mimic that kind of general behaviour, with the exception of FFCs?

The Screen Freeze (Except FFCs) combo is as close as you'll get. It won't suspend the global script, but that can be worked around.
 

Speaking of subscreens. I was also wondering if the pasive subscreen area is a valid draw target by any means, as it would be interesting to spawn specific menus over that area; and I do still need a ref sheet for overscan / screen offsets, with maximum offset coordinates in all four directions (+X, -X, +Y, -Y: I don't know if ZC treats Z as a valid direction for drawing functions of this sort; or if separate layers, that are still bound to a screen, are valid coordinates.)

If you draw with Y<0, it will draw over the active subscreen. If the "Subscreen Appears Above Sprites" rule is enabled, that will only work if you draw on layer 7.
The top-left of the screen is 0, 0, and the bottom-right is 255, 167. The passive subscreen extends to -56. There's no maximum or minimum; you can draw anywhere, even far offscreen.
There's no Z coordinate in drawing.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users