Author Topic: About WCLS and WCLSE opcodes.  (Read 2819 times)

Akari

  • *
  • Posts: 766
    • View Profile
About WCLS and WCLSE opcodes.
« on: 2007-07-20 13:20:17 »
I see wiki misses this two opcodes.

I disasmed them to help Synergy Blades understand it better:

Code: [Select]
////////////////////////////////////////////////////////
// 0x2E WCLS

v0 = [8009d820] = 0;
v0 = v0 & 3;
if (v0 != 0)
{
    800CAF7C lui    a0, $800a
    800CAF80 addiu  a0, a0, $0aa8
    800CAF84 jal    funcbead4 [$800bead4]
    800CAF88 ori    a1, zero, $0002
}

s0 = window_id; // window id from opcode

if ([8008326C + s0] != FF) // if window already shown
{
    v0 = 0;
    a0 = s0;

    set_state_to_close

    a0 = s0;
    a1 = 0;

    set_display_window

    v0 = 1;
}
else
{
    v0 = 0;

    move script pointer by 2
}
////////////////////////////////////////////////////////

First there are standart check for all opcodes. Don't know what are they check anyway.
[8008326C + s0] - id of entity that called this window. If window is not called this is 0xFF

As I understand - this opcode set given entity to close (set WINDOW STATE = 7)
And open new window with dialog id == 0

Next:

Code: [Select]
////////////////////////////////////////////////////////
// 0x54 WCLSE

v0 = [8009d820] = 0;
v0 = v0 & 3;
if (v0 != 0)
{
    800CAF7C lui    a0, $800a
    800CAF80 addiu  a0, a0, $0aa8
    800CAF84 jal    funcbead4 [$800bead4]
    800CAF88 ori    a1, zero, $0002
}

a0 = param1;

set_state_to_close

if (v0 == 0)
{
    v0 = 1;
}
else
{
    v0 = 0;
    move script pointer by 2
}
////////////////////////////////////////////////////////

This simply close window with given id.

And function

Code: [Select]
////////////////////////////////////////////////////////
set_state_to_close
a0 = window id

get window state

if ((window state - 1 >= D) || (window state - 1 == 0))
{
    return 0;
}

if (window state - 1 == {2, 4, 6, 8, 9, B})
{
    return 1;
}

if (window state - 1 == {1, 3, 5, 7, A, C})
{
    set window state to 7;
    return 0;
}
////////////////////////////////////////////////////////

Does this makes sence?

Synergy Blades

  • Guest
Re: About WCLS and WCLSE opcodes.
« Reply #1 on: 2007-07-20 13:29:16 »
The only reason I didn't fill them in was because I could not get them to work with my own dialogs and windows, as much as I can see that they seem to close dialogs such as timer windows and so on in FF7 fields I looked at.  :-( I may have a look later, see if the assembly helps any in getting it to work in a test field.

Akari

  • *
  • Posts: 766
    • View Profile
Re: About WCLS and WCLSE opcodes.
« Reply #2 on: 2007-07-20 13:36:10 »
The only reason I didn't fill them in was because I could not get them to work with my own dialogs and windows, as much as I can see that they seem to close dialogs such as timer windows and so on in FF7 fields I looked at.  :-( I may have a look later, see if the assembly helps any in getting it to work in a test field.

Please note how it close window using set_state_to_close function.
When window not opened it has state 0.
When it appears on screen (no text yet) it has state 1.
When text start appear it has state 2.
When it fully open it has state 6.
When you press OK the state set to 7.
When window dissapear state returns to 0.

I don't know much about other states.. maybe they are used for other types of windows.

MESSAGE opcode not skipped. It called each script circle untill you close dialog. And function set_display_window (this is where all state checks is.) called along with it.

Hmm I tried to close first frase that Barret says me and it closed well. I just can't see difference between this two opcodes Т_Т
« Last Edit: 2007-07-20 13:59:41 by Akari »

Akari

  • *
  • Posts: 766
    • View Profile
Re: About WCLS and WCLSE opcodes.
« Reply #3 on: 2007-09-11 18:13:51 »
Now I get real difference between this opcodes.
WCLS - makes sure that window will be closed because it closed it himself. Script waits until it closed and then continue works. It may be called from all entitys.
WCLSE - only set state to close but not done any real closing. Closing must be handled by MESSAGE or ASK opcodes in other entity. It may be called from all entitys.