601
Scripting and Reverse Engineering / How define playable character in FFVII?
« on: 2006-10-06 14:07:50 »
I knew it must be PC opcode, but can someone give me description of this opcode?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
English? lol. I break things, not look into how they broke.
If you were infront of me i'd hug you just for the thought of Q-Gears. Seriously though, nice work.
You cannot quit or use any of the keys to move around the field view.
Akari what are you using for the window system? Have you looked at Xenogears information for the conversations?
It might be good to use a more 'generic' system for the window system base and translate the FF7 opcodes and specifics acordingly.
0xD2 DialogShow(u8 dialog_id, u16 flags);
flags meaning are dont known
Entity* entity = new Entity();
entity->SetName("temp");
u8 script_a[114] = {
0x50,0x01,0xFF,0x00,0xFF,0x00,0x8A,0x00,0xA9,0x00,
0x48,0x05,0x01,0x00,0x00,0x09,0x00,
0x10,0x33,
0x52,0x01,0x02,0x00,
0x50,0x01,0xFF,0x00,0xFF,0x00,0x81,0x00,0x59,0x00,
0x48,0x05,0x01,0x01,0x00,0x04,0x00,
0x52,0x01,0x00,0x00,
0x10,0x21,
0x52,0x01,0x02,0x00,
0x50,0x01,0xFF,0x00,0xFF,0x00,0x81,0x00,0x59,0x00,
0x40,0x01,0x01,
0x52,0x01,0x00,0x00,
0x12,0x43,
0x15,0x50,0x00,0x00,0x00,0x16,0x00,
0x12,0x39,
0x15,0x50,0x00,0x00,0x00,0x04,0x00,
0x12,0x55,
0x15,0x50,0x00,0x01,0x00,0x04,0x00,
0x12,0x30,
0x15,0x50,0x00,0x02,0x00,0x0C,0x00,
0x60,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00
};
Script* script = new Script(script_a, 114);
entity->AddScript(0, script);
scriptManager.PushEntity(entity);
Each field object is linked to a particularly entity if that entity has a CHAR as its first opcode in its first script. Take a look at my explanation of the CHAR opcode on the wiki for more information; basically, while scanning through the script if you encounter a CHAR opcode, assign the next field object to the current entity (whose script you are scanning) and advance the 'field object pointer' to the next entry in the field object set. Ignore the CHAR argument as it has no bearing on the field object loaded for that model; the second example on the wiki entry demonstrates the numerical argument doesn't represent an offset into the model list.
Doors aren't 3D, they are part of the background, and linked to entities that open/close the doors using BGON and BGOFF opcodes to switch parts of the background on and off (i.e particular doors), as well as Triggers from Section 8 which, when crossed, run the particular scripts containing said BGON/BGOFF in the entity that manages the door. There's (usually?) one entity per door.
Oh ... hmmm which means My ISO FS stuff is useless? LOL.
Sigh..
I have to object...
You can't call it X-gears as you are not allowed to have a name cooler than mine....
:xÂ
The base opcode idea are the same. There are also opcodes for math operations, script calling, different type of jumps, dialog windows, background management, menu calling. character management. Although they are very game specific, all of them (exept return) have different format and different argument layout. Ow.. I forgot that there are camera management opcodes =)Multibyte encoding? Interesting. I suspect that is what FF8's script system does too! LOL. Basically it's a completely different encoding system. Might be a different script engine all together as well. The only thing the same is RET!
And... there are more than 256 opcodes =)
It works the same way. Just you can't count opcode 0xFE instead of this you can found a lot of opcodes that start from 0xFE00, 0xFE01, 0xFE02 and so on. So if system met 0xFE it's just read one more byte.
Oh and I found Request opcodes =)
0x08 EntityCallScriptSW(u8 entity, u4 priority, u4 script);
waits till script starts working and then continue
0x09 EntityCallScriptEW(u8 entity, u4 priority, u4 script);
waits till script finishes working and then continue
I still don't know what 0x80 in the end of many opcodes means =(
Akari how similiar are the opcodes to FF7's? It looks as if it uses a different encoding but similiar opcodes. Obviously they needed different opcodes.
32 is identical to FF7's count and it sounds like they have a periodic update function. Is there empty routines for unused slots like in FF7?
I wonder if it should use the same scripting code layout as for FF7. Hmmm.
Anyhow great work. As ussual
0x00 Return();
0x01 JumpTo(u16 address);
address - address in global script offset
0x02 ConditionalJumpTo(u8 offset, u8 databank, u16 value, u8 condition, u16 address);
if condition is wrong then jump
condition - 0x40 - A == B
- 0x41 - A != B
- 0x46 - A & B
address - address in global script offset
0x0B SpriteSet(u8 sprite_id, 80);
0x19 SpriteSetPosition(u16 x, u16 y, C0);
0x20 SpriteSetSolid(u8 type, 80);
type - 0x01 - can go through
- 0x02 - ???
- 0x04 - ???
- 0x08 - can't move
- and different combination of above flags
0x26 Wait(u8 time, 80);
time - the larger value - longer waiting
0x2C SpritePlayAnimation(u8 animation_id);
0x36 VariableSetTrue(u8 offset, u8 databank);
set two bytes from offset to 01 00
0x37 VariableSetFalse(u8 offset, u8 databank);
set two bytes from offset to 00 00
0x4A SpriteGoToPosition(u16 x, u16 y, C0);
0x69 SpriteSetDirection(u8 direction, 80);
direction - 0x00 - north
- 0x01 - north-east
- 0x02 - east
- 0x03 - south-east
- 0x04 - south
- 0x05 - south-west
- 0x06 - west
- 0x07 - north-west
- and so on...
0x6B SpriteRotateClockwise(u8 rotation, 80);
rotation - number of sprite rotation to skip (clockwise)
- 0x00 - stay as we are
- 0x01 - rotate one position clockwise
0x6C SpriteRotateAntiClockwise(u8 rotation, 80);
rotation - number of sprite rotation to skip (anti-clockwise)
- 0x00 - stay as we are
- 0x01 - rotate one position anti-clockwise
0x6F SpriteRotateToEntity(u8 entity_id);
0x98 MapLoad(u16 map_id, u8 location, 80);
0xA8 VariableRandom(u8 offset, u8 databank, u8 max_value, 80);
set two bytes from offset to random value from "00 00" to "max_value 00"
0xB3 FadeOut(u8 time, 80);
time - larger the value - longer the fade
0xB4 FadeIn(u8 time, 80);
time - larger the value - longer the fade
0xB5 CameraSetDirection(u8 direction, 80);
direction - 0x00 - north
- 0x01 - north-east
- 0x02 - east
- 0x03 - south-east
- 0x04 - south
- 0x05 - south-west
- 0x06 - west
- 0x07 - north-west
- and so on...
0xC7 CameraRotate(u8 time, 80);
don't know difference with CameraRotate2();
time - larger the value - longer the rotate
0xC8 CameraRotate2(u8 time, 80);
don't know difference with CameraRotate();
time - larger the value - longer the rotate
0xD2 DialogShow(u8 dialog_id, u16 flags);
flags meaning are dont known
// 0x04C5
entity[0F].script[00]()
{
SpriteSet(03, 80);
Return();
}
// 0x04C9
entity[0F].script[01]()
{
VariableRandom(0E, 04, 03, 80);
ConditionalJumpTo(0E, 04, 00 00, 40, E5 04); (#1)
SpriteGoToPosition(86 FF, B9 01, C0);
SpriteSetDirection(00, 80);
Wait(28, 80);
JumpTo(36 05); (#4)
#1 ConditionalJumpTo(0E, 04, 01 00, 40, FC 04); (#2)
SpriteGoToPosition(20 00, B9 01, C0);
SpriteSetDirection(00, 80);
Wait(28, 80);
JumpTo(36 05); (#4)
#2 ConditionalJumpTo(0E, 04, 02 00, 40, 13 05); (#3)
SpriteGoToPosition(4D FF, 56 01, C0);
SpriteSetDirection(06, 80);
Wait(28, 80);
JumpTo(36 05); (#4)
#3 ConditionalJumpTo(0E, 04, 03 00, 40, 36 05); (#4)
SpriteSetDirection(01, 80);
Wait(05, 80);
SpriteSetDirection(00, 80);
Wait(05, 80);
SpriteSetDirection(07, 80);
Wait(05, 80);
SpriteSetDirection(00, 80);
Wait(1E, 80);
JumpTo(36 05); (#4)
#4 04
}
// 0x0537
entity[0F].script[02]()
{
ConditionalJumpTo(02, 04, 00 00, 40, 42 05); (#1)
JumpTo(43 05); (#2)
#1 Return();
#2 SpriteRotateToEntity(01);
DialogShow(22, 00 00);
9C
5D025E
DialogShow(23, 00 00);
9C
2CFF
}
// 0x0554
entity[0F].script[03]()
{
Return();
}
// 0x0555
entity[0F].script[04]()
{
F4005A
92
}
// 0x0559
Lee
// 0x03AA
entity[0C].script[00]()
{
SpriteSet(04, 80);
SpriteSetSolid(08, 80);
SpriteSetDirection(00, 80);
FE0D0F80
Return();
}
// 0x03B8
entity[0C].script[01]()
{
Return();
}
// 0x03B9
entity[0C].script[02]()
{
VariableSetTrue(02, 04);
SpriteRotateToEntity(01);
ConditionalJumpTo(0C, 04, 00 00, 40, 07 04); (#1)
DialogShow(1A, 00 00);
9C
SpriteRotateClockwise(01, 80);
Wait(05, 80);
SpriteRotateAntiClockwise(01, 80);
Wait(0A, 80);
DialogShow(1B, 00 00);
9C
SpritePlayAnimation(00);
SpriteRotateClockwise(01, 80);
Wait(01, 80);
SpriteRotateClockwise(01, 80);
FE0DFC80
DialogShow(1C, 00 00);
9C
FE0D0F80
Wait(0A, 80);
SpriteRotateToEntity(01);
Wait(0A, 80);
DialogShow(1D, 00 00);
9C
VariableSetTrue(0C, 04)
JumpTo(0C 04); (#2)
#1 DialogShow(1E, 00 00);
9C
#2 SpritePlayAnimation(FF);
370204
}
// 0x0411
entity[0C].script[03]()
{
Return();
}
// 0x0412
entity[0C].script[04]()
{
Wait(14, 80);
A40C00DA00
}
// 0x041A
entity[0C].script[05]()
{
A419008F00
}
// 0x041F
entity[0C].script[06]()
{
ConditionalJumpTo(08, 00, 06 00, 40, 2F 04); (#1)
CameraSetDirection(02, 80);
3C80
JumpTo(54 04); (#4)
#1 ConditionalJumpTo(08, 00, 07 00, 40, 3F 04); (#2)
CameraSetDirection(02,80);
2880
JumpTo(54 04); (#4)
#2 ConditionalJumpTo(08, 00, 05 00, 40, 4F 04); (#3)
CameraSetDirection(02, 80);
2880
JumpTo(54 04); (#4)
#3 CameraSetDirection(02, 80);
1E80
#4 Return();
}
// 0x0455
entity[0C].script[06]()
{
F4005A
SpriteSetDirection(00, 80);
92
}
// 0x045C
I would like to suggest that all the sourcecode file names in Q-gears be made lowercase. This would help to reduce the number of case sensitive problems I'm seeing whilst trying to compile on my Linux box.
One such example is in trunk/src/filesystem/file.h which contains the follwing line :
 #include "../utilities/NoCopy.h"
The problem is that the file is nocopy.h which throws up problems on case sensitive filesystems.
HTH