19#define NULL ((void *)0)
40#include "text/msg_ids.h"
55#define FLAG_VENUS_LIGHTHOUSE_WALL_MOVED 0x300
56#define FLAG_VENUS_LIGHTHOUSE_WEST_WALL_MOVED 0x306
57#define FLAG_VENUS_LIGHTHOUSE_EAST_WALL_MOVED 0x307
60#define FLAG_VENUS_LIGHTHOUSE_GATE_OPEN 0x301
61#define FLAG_VENUS_LIGHTHOUSE_SOCKETS_A 0x302
62#define FLAG_VENUS_LIGHTHOUSE_SOCKETS_B 0x303
63#define FLAG_VENUS_LIGHTHOUSE_THREE_BLOCK_GATE_OPEN 0x304
64#define FLAG_VENUS_LIGHTHOUSE_PILLAR_GATE_OPEN 0x308
69#define VENUS_LIGHTHOUSE_FIXED_OFFSET(value, bits) ((value) * (1 << (bits)))
71#define VENUS_LIGHTHOUSE_FIXED_OFFSET(value, bits) ((value) << (bits))
75#define VENUS_LIGHTHOUSE_RUN_OPENING_SEQUENCE \
76 VenusLighthouse_ArriveThroughSparkPassage
78#define VENUS_LIGHTHOUSE_RUN_OPENING_SEQUENCE \
79 ((s32 (*)(void))VenusLighthouse_ArriveThroughSparkPassage)
83#define VENUS_DESCENT_COLLISION_X 33
84#define VENUS_DESCENT_COLLISION_WIDTH 7
86#define VENUS_DESCENT_COLLISION_X 34
87#define VENUS_DESCENT_COLLISION_WIDTH 5
136 object->motionFlags = 0;
137 object->collisionFlags = 8;
192 directionIndex = leader->
facing >> 12;
195 targetPosition.
x = leader->
x.
fixed + (packedStep & 0xffff0000);
196 targetPosition.
y = leader->
y.
fixed;
198 targetPosition.
z = leader->
z.
fixed + packedStep;
199 block = SceneData_FindSlotAtPosition(&targetPosition, leader);
204 targetPosition.
x = block->
x.
fixed + (packedStep & 0xffff0000);
205 targetPosition.
y = block->
y.
fixed;
207 targetPosition.
z = block->
z.
fixed + packedStep;
208 blockingActor = SceneData_FindSlotAtPosition(&targetPosition, block);
209 if (blockingActor != 0 && (blockingActor->
collisionFlags & 1) != 0)
212 targetPosition.
x = block->
x.
fixed;
213 targetPosition.
y = block->
y.
fixed + 0x100000;
214 targetPosition.
z = block->
z.
fixed;
215 blockingActor = SceneData_FindSlotAtPosition(&targetPosition, block);
216 if (blockingActor != 0 && (blockingActor->
collisionFlags & 1) != 0)
221 targetPosition.
x = block->
x.
fixed + (packedStep & 0xffff0000);
222 targetPosition.
y = block->
y.
fixed;
224 targetPosition.
z = block->
z.
fixed + packedStep;
229 if (transitionBusy != 0)
237 block->
speed = moveRate;
241 leader->
speed = moveRate;
247 block->
x.
fixed = targetPosition.
x;
248 block->
z.
fixed = targetPosition.
z;
271 if (layerIndex <= 2) {
276 cells += x + (z << 7);
277 for (row = 0; row < height; row++) {
278 struct MapCell *cell = cells + (row << 7);
280 for (column = 0; column < width; column++) {
295 for (actorId = 8; actorId <= 65; actorId++) {
296 actor = actors[actorId - 8];
297 if (actor->
timer >> 4 == 0x212)
319 void *actor = (
void *)fieldObject;
346 s32 framePhase, particleX, particleY, riseSpeed;
348 if (framePhase == 0) {
359 Effect_Spawn(particleX, particleY, actor->
z.
fixed, 0, riseSpeed, framePhase,
360 0x000b0000, &options);
372 void *actor = (
void *)interpreter;
400 Effect_Spawn(actor->
x.
fixed +
402 actor->
y.
fixed + 0x001a0000, actor->
z.
fixed, 0, -fallSpeed, 0,
403 0x000a0000, &options);
406 if (framePhase == 0) {
409 Effect_Spawn(actor->
x.
fixed +
411 actor->
y.
fixed, actor->
z.
fixed, 0, 0, 0, 0x000a0000, &options);
438 leader->
speed = 0x3333;
462 (leader->
z.
part.pixel << 16) - 0x100000);
524 for (particleIndex = 0; particleIndex <= 16; particleIndex++) {
528 angle = particleIndex << 12;
530 velocity[0] += velocity[0] / 2;
532 velocity[1], velocity[2], 0x1090001, &options);
585 velocityX =
Math_Divide(((((
u32)(random * 9)) >> 16) - 4) << 16, 10);
587 velocityZ =
Math_Divide(((((
u32)(random * 9)) >> 16) - 4) << 16, 10);
589 velocityX, velocityY, velocityZ, 0x001c0001, &options);
610 effect->
speed = 0x10000;
645 savedMotionFlags = *motionFlags;
647 landing.
x = (leader->
x.
fixed & 0xfff00000) + 0x80000;
649 landing.
z = (leader->
z.
fixed & 0xfff00000) + 0x80000;
650 direction = (leader->
facing + 0x2000) & 0xc000;
653 direction = leader->
facing >> 12;
655 landing.
x = leader->
x.
fixed + (step & 0xffff0000);
658 landing.
z = leader->
z.
fixed + step;
661 SceneData_FindSlotAtPosition(&landing, leader) == 0) {
663 landing.
x = (leader->
x.
fixed & 0xfff00000) + 0x80000;
665 landing.
z = (leader->
z.
fixed & 0xfff00000) + 0x80000;
670 landing.
x = leader->
x.
fixed + ((step & 0xffff0000) << 1);
673 landing.
z = leader->
z.
fixed + step;
675 if (SceneData_FindSlotAtPosition(&landing, leader) == 0 &&
682 leader->
speed = 0x30000;
685 *motionFlags &= 0x7e;
691 *motionFlags = savedMotionFlags;
789 if (flickerDelay > 3) {
793 }
while (flickersLeft != 0);
817 if (block->
x.
fixed >> 20 == 54 || block->
z.
fixed >> 20 == 6) {
827#if TBS_PATCH_LEVEL != 1
832#if TBS_PATCH_LEVEL == 1
833 message = (
s32)MSGNO(MsgVenusThereWordsCarvedIntoRelief);
836 work->
facingTrigger + MSGNO(MsgVenusThereWordsCarvedIntoRelief) - 35;
895 if (leader->
z.
fixed >> 20 <= 54) {
897 landingQuarterZ = 210;
900 landingQuarterZ = 238;
903 landingQuarterZ << 2);
1002 s32 conversationFlag;
1004 s32 walkAcceleration;
1010 walkAcceleration = 0x6666;
1015 if (actor->
x.
fixed >> 20 == 53) {
1048 leader->
z.
part.pixel);
1075 if (block->
x.
fixed >> 20 == 42) {
1079 switchHeight = 0xfffe0000;
1081 block->
y.
fixed = switchHeight;
1194 OverlayObject_WaitUntilIdle(0);
1208 s32 destinationColumn;
1215 destinationColumn = 12;
1216 destinationRow = 44;
1218 destinationColumn = 11;
1219 destinationRow = 51;
1224 column = block->
x.
fixed >> 20;
1225 row = block->
z.
fixed >> 20;
1228 }
while (blockIndex <= 2);
1254 }
while (blockIndex <= 1);
1266 if (block->
y.
fixed > -0x100000) {
1270 }
while (blockIndex <= 1);
1292 column = block->
x.
fixed >> 20;
1293 row = block->
z.
fixed >> 20;
1304 sprite = block->sprite;
1310 block->
x.
fixed, 0, 0x2000000, 223);
1311 OverlayObject_WaitUntilIdle(block);
1327 if (block->
x.
fixed >> 20 == 8) {
1328 OverlayObject_WaitUntilIdle(block);
1334 if (block->
x.
fixed >> 20 == 7) {
1335 OverlayObject_WaitUntilIdle(block);
1357 column = leader->
x.
part.pixel;
1358 leaderZ = leader->
z.
part.pixel;
1360 if (column >= 308 && column <= 315 && leaderZ >= 532 && leaderZ < 540) {
1376 for (frame = 0; frame <= 479; frame++, tileDelay--) {
1377 scrollLayer->
offsetX += 0x3333;
1385 Effect_Spawn(dustX, 0, 0x2100000, 0, -(((
gFrameCount & 1) * 3) << 16),
1386 0, 0x8a0000, &options);
1390 if (tileDelay == 0) {
1402 scrollLayer->
offsetX += 0x8000;
1429 occlusionEffect = 0;
1441 column = block->
x.
fixed >> 20;
1444 row = block->
z.
fixed >> 20;
1450 if (gateOpened != 0) {
1452 if ((leader->
z.
fixed >> 20) <= 45) {
1454 0x2e80000, 0, 0x2c00000, 20);
1462 block->
bounce = gateOpened;
1464 OverlayObject_WaitUntilIdle(block);
1528 for (blockId = 9; blockId <= 11; blockId++) {
1539 for (candidateIndex = 0; candidateIndex <= 3; candidateIndex++) {
1543 switchIndex = candidateIndex;
1547 if (switchIndex == 5) {
1550 for (candidateIndex = 9; candidateIndex <= 11; candidateIndex++) {
1552 if (blockId != candidateIndex &&
1559 if (switchIndex == 5) {
1564 savedPriority = leader->sprite->image.priority;
1577 OverlayObject_WaitUntilIdle(block);
1593 if (occlusionEffect != 0) {
1613 if (firstGateEffect->riseEnabled != 0 ||
1614 secondGateEffect->riseEnabled != 0) {
1677 if (waitFrames != 0) {
1690 if (waitFrames != 0) {
1693 for (blockIndex = 0; blockIndex < 5; blockIndex++) {
1696 if (actor->
y.
fixed / 0x10000 < 0 && actor->
y.
fixed / 0x10000 > -30) {
1708 s32 supportHeight = 0xffb00000;
1712 for (candidateIndex = 0; candidateIndex <= 5; candidateIndex++) {
1713 s32 candidateId = candidateIndex + 8;
1716 if (candidateId == blockId) {
1723 if ((candidate->
x.
fixed >> 20) != (block->
x.
fixed >> 20) ||
1724 (candidate->
z.
fixed >> 20) != (block->
z.
fixed >> 20)) {
1729 if (supportHeight <= candidateTop) {
1730 block->
timer = candidateId;
1731 supportHeight = candidateTop;
1751 block->
timer = resetValue;
1779 for (blockIndex = 0; blockIndex < 4; blockIndex++) {
1781 column = block->
x.
fixed >> 20;
1782 if (column == 13 && (row = block->
z.
fixed >> 20) == 7 &&
1784 OverlayObject_WaitUntilIdle(block);
1792 if (block->sprite->image.priority == 3 &&
1799 block->
bounce = earlierIndex;
1800 if (block->
z.
fixed >> 20 <= 12) {
1802 block->
x.
fixed, 0, 0xe00000, 253);
1804 block->
x.
fixed, 0, 0xf00000, 253);
1806 OverlayObject_WaitUntilIdle(block);
1813 if (block->
z.
fixed >> 20 == 19 &&
1818 settledIndex = blockIndex;
1819 for (earlierIndex = 0; earlierIndex < blockIndex; earlierIndex++) {
1825 settledIndex = earlierIndex;
1884 column = leader->
x.
part.pixel;
1885 leaderZ = leader->
z.
part.pixel;
1887 if (column >= 532 && column <= 539 && leaderZ >= 324 && leaderZ < 332) {
1903 for (frame = 0; frame <= 319; frame++, tileDelay--) {
1904 scrollLayer->
offsetX += 0x3333;
1905 if (dustX >= 0x2400000 && frame > 40) {
1913 Effect_Spawn(dustX, 0, 0x1200000, 0, -(((
gFrameCount & 1) * 3) << 16),
1914 0, 0x8a0000, &options);
1915 if (tileDelay == 0) {
1923 scrollLayer->
offsetX += 0x8000;
1950 column = leader->
x.
part.pixel;
1951 leaderZ = leader->
z.
part.pixel;
1953 if (column >= 788 && column <= 795 && leaderZ >= 324 && leaderZ < 332) {
1968 for (frame = 0; frame <= 319; frame++, tileDelay--) {
1969 scrollLayer->
offsetX += -0x3333;
1971 if (dustX >= 0x2c80000 && dustX < 0x2f00000) {
1978 Effect_Spawn(dustX, 0, 0x1200000, 0, -(((
gFrameCount & 1) * 3) << 16),
1979 0, 0x8a0000, &options);
1980 if (tileDelay == 0) {
1988 scrollLayer->
offsetX += 0x8000;
2019 occlusionEffect = 0;
2028 for (blockId = 15; blockId <= 18; blockId++) {
2039 for (candidateIndex = 0; candidateIndex < 8; candidateIndex++) {
2043 switchIndex = candidateIndex;
2047 if (switchIndex == 8)
2049 for (candidateIndex = 15; candidateIndex <= 18; candidateIndex++) {
2051 if (blockId != candidateIndex &&
2052 (block->
x.
fixed >> 20) == (otherBlock->
x.
fixed >> 20) &&
2053 (block->
z.
fixed >> 20) == (otherBlock->
z.
fixed >> 20)) {
2058 if (switchIndex == 8)
2061 savedPriority = leader->sprite->image.priority;
2067 for (candidateIndex = 15; candidateIndex <= 18; candidateIndex++) {
2069 if (blockId != candidateIndex &&
2070 (block->
x.
fixed >> 20) == (otherBlock->
x.
fixed >> 20) &&
2071 (block->
z.
fixed >> 20) - 1 == (otherBlock->
z.
fixed >> 20))
2082 OverlayObject_WaitUntilIdle(block);
2094 for (candidateIndex = 15; candidateIndex <= 18; candidateIndex++) {
2096 if (blockId != candidateIndex &&
2097 (block->
x.
fixed >> 20) == (otherBlock->
x.
fixed >> 20) &&
2098 (block->
z.
fixed >> 20) - 1 == (otherBlock->
z.
fixed >> 20)) {
2237 }
while (actorId <= 18);
2357 if (actor->
x.
fixed >> 20 == 8)
2360 if (actor->
x.
fixed >> 20 == 7)
2466 asm(
"" :
"+l"(zero));
2594 for (blockIndex = 0; blockIndex <= 3; blockIndex++) {
2807 nextPosition.
y = actor->
y.
fixed;
2812 if (framePhase == 0) {
2814 particleX = actor->
x.
fixed +
2816 Effect_Spawn(particleX, actor->
y.
fixed, actor->
z.
fixed,
2822 0x800000, &options);
2825 if (collision < 0) {
2840 nextPosition.
y = actor->
y.
fixed;
2844 if (collision > 0) {
2848 actor->
x.
fixed + direction->
x * 0x5b333 - direction->
z * 0x5b333;
2849 nextPosition.
y = actor->
y.
fixed;
2851 actor->
z.
fixed + direction->
z * 0x5b333 - direction->
x * 0x5b333;
2853 if (collision > 0) {
2858 nextPosition.
x = (direction->
x + direction->
z) * 0x5b333 + actor->
x.
fixed;
2859 nextPosition.
y = actor->
y.
fixed;
2860 nextPosition.
z = (direction->
x + direction->
z) * 0x5b333 + actor->
z.
fixed;
2862 if (collision > 0) {
2901 for (row = 0; row < 10; row++) {
2904 for (particleIndex = 0; particleIndex < 4 && row < 8; particleIndex++) {
2906 0, 0x300000 + row * 0x100000 + particleIndex * 0x40000, 0,
2907 0, 0, 0x880000, &options);
2910 if (row != 3 || extraBursts >= 3) {
2921 for (row = 0; row < 10; row++) {
2923 for (particleIndex = 0; particleIndex < 4 && row < 8; particleIndex++) {
2925 0, 0x300000 + row * 0x100000 + particleIndex * 0x40000, 0, 0,
2926 0, 0x880000, &options);
2950 0x880000, &options);
2953 (x << 19) - 0x40000, 0, 0, 0, 0x880000, &options);
2990 effectOptions = &options;
2996 particleZ = 0xc00000;
2997 for (particleIndex = 0, zero = 0, particleZ += rowOffset;
2998 particleIndex <= 3; particleIndex++) {
3000 0, particleZ, 0, zero, zero, 0x880000, effectOptions);
3001 particleZ += 0x40000;
3005 if (extraBursts <= 2) {
3009 if (extraBursts == 3)
3014 rowOffset += 0x100000;
3016 }
while (row <= 12);
3050 effectOptions = &options;
3056 particleZ = 0xc00000;
3057 for (particleIndex = 0, zero = 0, particleZ += rowOffset;
3058 particleIndex <= 3; particleIndex++) {
3060 0, particleZ, 0, zero, zero, 0x880000, effectOptions);
3061 particleZ += 0x40000;
3064 if (row == 3 && extraBursts <= 2) {
3070 rowOffset += 0x100000;
3072 }
while (row <= 12);
3095 s32 particleX, particleY, particleZ, riseSpeed;
3099 effectOptions->
type = 286;
3102 if (framePhase == 0) {
3113 Effect_Spawn(particleX, particleY, particleZ, 0, riseSpeed, framePhase,
3114 0x330000, effectOptions);
3186 for (riseFrame = 0; riseFrame < 128; riseFrame++) {
3203 const u8 *allowedShapes;
3207 const u8 *shapeCursor;
3209 supportPosition.
x = block->
x.
fixed;
3210 supportPosition.
y = block->
y.
fixed - 0x100000;
3211 supportPosition.
z = block->
z.
fixed;
3212 support = SceneData_FindSlotAtPosition(&supportPosition, 0);
3215 sprite = support->sprite;
3218 s32 speedX = velocityX < 0 ? -velocityX : velocityX;
3220 s32 speedZ = velocityZ < 0 ? -velocityZ : velocityZ;
3222 if (speedX > speedZ) {
3223 if (velocityX / 0x10000 < 0) {
3229 if (velocityZ / 0x10000 < 0) {
3235 for (; *allowedShapes != 0; allowedShapes++) {
3236 if (sprite->
lastNo == *allowedShapes) {
3240 if (*allowedShapes == 0) {
3246 for (switchIndex = 0;
3252 for (shapeIndex = 0;; shapeIndex++) {
3254 shapeId = *shapeCursor;
3259 if (shapeId == support->sprite->lastNo) {
3267 for (switchIndex = 0;
3273 for (shapeIndex = 0;; shapeIndex++) {
3275 shapeId = *shapeCursor;
3280 if (shapeId == support->sprite->lastNo) {
3312#define DIRECTION_STEP(dx, dz) (((u32)(dx) << 16) | ((dz) & 0xffff))
3314#define DIRECTION_STEP(dx, dz) (((dx) << 16) | ((dz) & 0xffff))
3335 0xfff00000, 0xfff00000, 0xffe00000, 0xffd00000, 0xffc00000, 0xffb00000, 0xffb00000,
3795 MAP_CELL_STEP(124, 50, 1, 2, 6),
MAP_CELL_STEP(124, 47, 1, 2, 6),
MAP_CELL_STEP(124, 44, 1, 2, 6),
MAP_CELL_STEP(124, 41, 1, 2, 6),
MAP_CELL_STEPS_END,
3799 MAP_CELL_STEP(117, 59, 1, 2, 6),
MAP_CELL_STEP(115, 59, 1, 2, 6),
MAP_CELL_STEP(113, 59, 1, 2, 6),
MAP_CELL_STEP(111, 59, 1, 2, 6),
MAP_CELL_STEPS_END,
3803 MAP_CELL_STEP(96, 58, 1, 2, 6),
MAP_CELL_STEP(95, 58, 1, 2, 6),
MAP_CELL_STEP(96, 56, 1, 2, 6),
MAP_CELL_STEP(95, 56, 1, 2, 6),
MAP_CELL_STEPS_END,
3807 { 1,
CONDITION_ALWAYS, 40, 0, 264,
FACING_EAST, 0, 0, 0, 512, 544, 0 },
3808 { 2,
CONDITION_ALWAYS, 376, 0, 88,
FACING_SOUTH, 0, 0, 0, 512, 544, 0 },
3809 { 3,
CONDITION_ALWAYS, 488, 0, 424,
FACING_WEST, 0, 0, 0, 512, 544, 0 },
3814 { 1,
CONDITION_ALWAYS, 120, 0, 200,
FACING_NORTH, 0, 0, 56, 240, 216, 0 },
3815 { 2,
CONDITION_ALWAYS, 120, 0, 104,
FACING_SOUTH, 0, 0, 56, 240, 216, 0 },
3816 { 3,
CONDITION_ALWAYS, 344, 0, 232,
FACING_NORTH, 0, 256, 48, 512, 248, 0 },
3817 { 4,
CONDITION_ALWAYS, 472, 0, 184,
FACING_SOUTH, 0, 256, 48, 512, 248, 0 },
3818 { 5,
CONDITION_ALWAYS, 376, 0, 184,
FACING_SOUTH, 0, 256, 48, 512, 248, 0 },
3819 { 6,
CONDITION_ALWAYS, 344, 0, 104,
FACING_SOUTH, 0, 256, 48, 512, 248, 0 },
3820 { 7,
CONDITION_ALWAYS, 840, 0, 248,
FACING_NORTH, 0, 672, 32, 1008, 256, 0 },
3821 { 8,
CONDITION_ALWAYS, 968, 0, 168,
FACING_SOUTH, 0, 672, 32, 1008, 256, 0 },
3822 { 9,
CONDITION_ALWAYS, 856, 0, 88,
FACING_SOUTH, 0, 672, 32, 1008, 256, 0 },
3823 { 10,
CONDITION_ALWAYS, 808, 0, 88,
FACING_SOUTH, 0, 672, 32, 1008, 256, 0 },
3824 { 11,
CONDITION_ALWAYS, 712, 0, 168,
FACING_SOUTH, 0, 672, 32, 1008, 256, 0 },
3825 { 12,
CONDITION_ALWAYS, 200, 0, 408,
FACING_NORTH, 0, 16, 288, 256, 520, 0 },
3826 { 13,
CONDITION_ALWAYS, 104, 0, 504,
FACING_NORTH, 0, 16, 288, 256, 520, 0 },
3827 { 14,
CONDITION_ALWAYS, 104, 0, 472,
FACING_SOUTH, 0, 16, 288, 256, 520, 0 },
3828 { 20,
CONDITION_ALWAYS, 520, 0, 696,
FACING_SOUTH, 0, 304, 344, 576, 728, 0 },
3829 { 21,
CONDITION_ALWAYS, 344, 0, 568,
FACING_SOUTH, 0, 304, 344, 576, 728, 0 },
3830 { 22,
CONDITION_ALWAYS, 728, 0, 936,
FACING_SOUTH, 0, 600, 736, 840, 952, 0 },
3831 { 23,
CONDITION_ALWAYS, 744, 0, 792,
FACING_SOUTH, 0, 600, 736, 840, 952, 0 },
3832 { 24,
CONDITION_ALWAYS, 392, 0, 952,
FACING_SOUTH, 0, 272, 808, 512, 984, 0 },
3833 { 25,
CONDITION_ALWAYS, 392, 0, 856,
FACING_SOUTH, 0, 272, 808, 512, 984, 0 },
3834 { 26,
CONDITION_ALWAYS, 760, 0, 936,
FACING_SOUTH, 0, 600, 736, 840, 952, 0 },
3835 { 30,
CONDITION_ALWAYS, 88, 0, 872,
FACING_SOUTH, 0, 16, 600, 256, 920, 0 },
3836 { 31,
CONDITION_ALWAYS, 184, 0, 872,
FACING_SOUTH, 0, 16, 600, 256, 920, 0 },
3837 { 32,
CONDITION_ALWAYS, 184, 0, 648,
FACING_SOUTH, 0, 16, 600, 256, 920, 0 },
3842 { 1,
CONDITION_ALWAYS, 456, 0, 552,
FACING_SOUTH, 0, 376, 344, 736, 624, 0 },
3843 { 2,
CONDITION_ALWAYS, 456, 0, 592,
FACING_NORTH, 0, 376, 344, 736, 624, 0 },
3844 { 3,
CONDITION_ALWAYS, 696, 0, 472,
FACING_SOUTH, 0, 376, 344, 736, 624, 0 },
3845 { 4,
CONDITION_ALWAYS, 696, 0, 512,
FACING_NORTH, 0, 376, 344, 736, 624, 0 },
3846 { 5,
CONDITION_ALWAYS, 424, 0, 136,
FACING_SOUTH, 0, 344, 48, 592, 216, 0 },
3847 { 6,
CONDITION_ALWAYS, 520, 0, 176,
FACING_NORTH, 0, 344, 48, 592, 216, 0 },
3848 { 7,
CONDITION_ALWAYS, 104, 0, 752,
FACING_NORTH, 0, 56, 584, 304, 880, 0 },
3849 { 8,
CONDITION_ALWAYS, 200, 0, 680,
FACING_SOUTH, 0, 56, 584, 304, 880, 0 },
3850 { 9,
CONDITION_ALWAYS, 88, 0, 344,
FACING_SOUTH, 0, 40, 280, 288, 496, 0 },
3851 { 10,
CONDITION_ALWAYS, 248, 0, 432,
FACING_NORTH, 0, 40, 280, 288, 496, 0 },
3852 { 11,
CONDITION_ALWAYS, 664, 0, 264,
FACING_SOUTH, 0, 616, 40, 1000, 360, 0 },
3853 { 12,
CONDITION_ALWAYS, 728, 0, 136,
FACING_SOUTH, 0, 616, 40, 1000, 360, 0 },
3854 { 13,
CONDITION_ALWAYS, 840, 0, 136,
FACING_SOUTH, 0, 616, 40, 1000, 360, 0 },
3855 { 14,
CONDITION_ALWAYS, 952, 0, 136,
FACING_SOUTH, 0, 616, 40, 1000, 360, 0 },
3856 { 15,
CONDITION_ALWAYS, 840, 0, 360,
FACING_NORTH, 0, 616, 40, 1000, 360, 0 },
3857 { 16,
CONDITION_ALWAYS, 88, 0, 152,
FACING_SOUTH, 0, 40, 40, 328, 208, 0 },
3858 { 17,
CONDITION_ALWAYS, 184, 0, 104,
FACING_SOUTH, 0, 40, 40, 328, 208, 0 },
3859 { 18,
CONDITION_ALWAYS, 280, 0, 152,
FACING_SOUTH, 0, 40, 40, 328, 208, 0 },
3860 { 19,
CONDITION_ALWAYS, 472, 0, 776,
FACING_SOUTH, 0, 424, 688, 672, 848, 0 },
3861 { 20,
CONDITION_ALWAYS, 600, 0, 776,
FACING_SOUTH, 0, 424, 688, 672, 848, 0 },
3862 { 21,
CONDITION_ALWAYS, 840, 0, 136,
FACING_SOUTH, 0, 616, 40, 1000, 360, 0 },
3867 { 1,
CONDITION_ALWAYS, 104, 0, 120,
FACING_SOUTH, 0, 56, 56, 368, 272, 0 },
3868 { 2,
CONDITION_ALWAYS, 312, 0, 200,
FACING_SOUTH, 0, 56, 56, 368, 272, 0 },
3869 { 3,
CONDITION_ALWAYS, 600, 0, 216,
FACING_NORTH, 0, 552, 88, 848, 544, 0 },
3870 { 4,
CONDITION_ALWAYS, 696, 0, 312,
FACING_SOUTH, 0, 552, 88, 848, 544, 0 },
3871 { 5,
CONDITION_ALWAYS, 648, 0, 536,
FACING_NORTH, 0, 552, 88, 848, 544, 0 },
3872 { 6,
CONDITION_ALWAYS, 776, 0, 536,
FACING_SOUTH, 0, 552, 88, 848, 544, 0 },
3873 { 7,
CONDITION_ALWAYS, 104, 0, 520,
FACING_SOUTH, 0, 56, 392, 352, 608, 0 },
3874 { 8,
CONDITION_ALWAYS, 312, 0, 584,
FACING_NORTH, 0, 56, 392, 352, 608, 0 },
3875 { 9,
CONDITION_ALWAYS, 744, 0, 696,
FACING_SOUTH, 0, 648, 632, 896, 800, 0 },
3876 { 10,
CONDITION_ALWAYS, 808, 0, 696,
FACING_SOUTH, 0, 648, 632, 896, 800, 0 },
3877 { 11,
CONDITION_ALWAYS, 312, 0, 536,
FACING_SOUTH, 0, 56, 392, 352, 608, 0 },
3882 { 1,
CONDITION_ALWAYS, 136, 0, 136,
FACING_SOUTH, 0, 8, 56, 256, 224, 0 },
3883 { 2,
CONDITION_ALWAYS, 136, 0, 184,
FACING_NORTH, 0, 8, 56, 256, 224, 0 },
3884 { 3,
CONDITION_ALWAYS, 136, 0, 392,
FACING_NORTH, 0, 8, 264, 256, 432, 0 },
3885 { 4,
CONDITION_ALWAYS, 312, 0, 680,
FACING_SOUTH, 0, 248, 600, 512, 768, 0 },
3886 { 5,
CONDITION_ALWAYS, 392, 0, 680,
FACING_SOUTH, 0, 248, 600, 512, 768, 0 },
3887 { 6,
CONDITION_ALWAYS, 472, 0, 680,
FACING_SOUTH, 0, 248, 600, 512, 768, 0 },
3888 { 7,
CONDITION_ALWAYS, 136, 0, 792,
FACING_SOUTH, 0, 8, 728, 256, 928, 0 },
3889 { 8,
CONDITION_ALWAYS, 136, 0, 904,
FACING_NORTH, 0, 8, 728, 256, 928, 0 },
3890 { 9,
CONDITION_ALWAYS, 312, 0, 232,
FACING_NORTH, 0, 264, 56, 720, 480, 0 },
3891 { 10,
CONDITION_ALWAYS, 376, 0, 184,
FACING_SOUTH, 0, 264, 56, 720, 480, 0 },
3892 { 11,
CONDITION_ALWAYS, 504, 0, 248,
FACING_SOUTH, 0, 264, 56, 720, 480, 0 },
3893 { 12,
CONDITION_ALWAYS, 680, 0, 120,
FACING_SOUTH, 0, 264, 56, 720, 480, 0 },
3894 { 13,
CONDITION_ALWAYS, 312, 0, 440,
FACING_SOUTH, 0, 264, 56, 720, 480, 0 },
3895 { 14,
CONDITION_ALWAYS, 632, 0, 392,
FACING_NORTH, 0, 264, 56, 720, 480, 0 },
3896 { 15,
CONDITION_ALWAYS, 728, 0, 632,
FACING_SOUTH, 0, 680, 568, 928, 768, 0 },
3897 { 16,
CONDITION_ALWAYS, 888, 0, 632,
FACING_SOUTH, 0, 680, 568, 928, 768, 0 },
3898 { 17,
CONDITION_ALWAYS, 136, 0, 568,
FACING_SOUTH, 0, 8, 480, 256, 648, 0 },
3899 { 18,
CONDITION_ALWAYS, 136, 0, 600,
FACING_NORTH, 0, 8, 480, 256, 648, 0 },
3900 { 19,
CONDITION_ALWAYS, 440, 0, 264,
FACING_NORTH, 0, 264, 56, 720, 480, 0 },
3901 { 20,
CONDITION_ALWAYS, 568, 0, 264,
FACING_NORTH, 0, 264, 56, 720, 480, 0 },
3906 { 1,
CONDITION_ALWAYS, 120, 0, 248,
FACING_SOUTH, 0, 72, 56, 320, 416, 0 },
3907 { 2,
CONDITION_ALWAYS, 280, 0, 280,
FACING_NORTH, 0, 72, 56, 320, 416, 0 },
3908 { 3,
CONDITION_ALWAYS, 472, 0, 328,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3909 { 4,
CONDITION_ALWAYS, 536, 0, 216,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3910 { 5,
CONDITION_ALWAYS, 664, 0, 88,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3911 { 6,
CONDITION_ALWAYS, 744, 0, 152,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3912 { 7,
CONDITION_ALWAYS, 840, 0, 152,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3913 { 8,
CONDITION_ALWAYS, 936, 0, 280,
FACING_NORTH, 0, 424, 24, 992, 560, 0 },
3914 { 9,
CONDITION_ALWAYS, 472, 0, 472,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3915 { 10,
CONDITION_ALWAYS, 616, 0, 456,
FACING_NORTH, 0, 424, 24, 992, 560, 0 },
3916 { 11,
CONDITION_ALWAYS, 728, 0, 456,
FACING_NORTH, 0, 424, 24, 992, 560, 0 },
3917 { 12,
CONDITION_ALWAYS, 824, 0, 456,
FACING_NORTH, 0, 424, 24, 992, 560, 0 },
3918 { 13,
CONDITION_ALWAYS, 792, 0, 648,
FACING_SOUTH, 0, 712, 584, 976, 864, 0 },
3919 { 14,
CONDITION_ALWAYS, 904, 0, 648,
FACING_SOUTH, 0, 712, 584, 976, 864, 0 },
3920 { 15,
CONDITION_ALWAYS, 104, 0, 776,
FACING_SOUTH, 0, 56, 536, 304, 848, 0 },
3921 { 16,
CONDITION_ALWAYS, 216, 0, 600,
FACING_SOUTH, 0, 56, 536, 304, 848, 0 },
3922 { 17,
CONDITION_ALWAYS, 600, 0, 744,
FACING_SOUTH, 0, 392, 648, 640, 832, 0 },
3923 { 18,
CONDITION_ALWAYS, 536, 0, 328,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3924 { 19,
CONDITION_ALWAYS, 792, 0, 328,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
3925 { 20,
CONDITION_ALWAYS, 664, 0, 136,
FACING_SOUTH, 0, 424, 24, 992, 560, 0 },
4229#if TBS_PATCH_LEVEL != 1
Ability numbers, named from the English release.
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void Object_SetActionById(u32 objectId, s32 steps)
Sets the animation timer steps of each of an actor's sprites (AnimationObjects_SetActiveTimerSteps).
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
const struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
s32 gStagedActor_DirectionSteps[]
Pixel step by direction: X in the upper halfword, Z in the lower.
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
const s32 * gEffectScripts[]
Calls through a function pointer, by argument count.
struct FieldActor * Camera_GetEventObject(void)
The event command "get view centre": returns the camera object.
void Object_PlaceCurrentWithinCameraBounds(s32 actor, s32 glide)
The event command "camera move to actor": Camera_MoveWithinMapBounds to the actor's x and z.
The engine calls the debug menus import, and their palette swatch tiles.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
static void SceneEffect_SpawnNineRadialEffects(s32 actor)
Burst nine particles out from the actor in a ring (the ninth on the first), flung a third further eas...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
static s32 FieldObject_CheckMovementCollision(struct FieldActor *actor, struct FieldPosition *position)
static void FieldBattleFx_RunRisingObjectSequence(s32 actor, s32 mode, s32 action)
void BattleFx_StartFadeOverlay(void *object)
Starts the fade overlay on object (the party leader when NULL): loads its solid tiles,...
void ObjectDispatch_WaitForValue16(void *rawObject)
Waits until the object's script reaches SC_END (0x10), at most 300 frames.
void FieldScene_PrepareActors(struct ScenePlacement *entry)
Field effects, their scripts and the flags that spawn them.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_ObjectSetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Object_SetMode(struct FieldActor *object, s32 animation)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Map_CopyCellsTo(s32 srcX, s32 srcY, s32 destX, s32 destY, s32 width, s32 height)
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
static void Actor_WalkByAndWait(s32 actor, s32 dx, s32 dz)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
static s32 Math_Divide(s32 dividend, s32 divisor)
void Engine_ObjectSetBlendMode(struct FieldActor *object, s32 mode)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
void Engine_MapRenderWaitForValues(void)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_ActorWaitForMove(s32 actor)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
void Engine_ActorSetAttachedEffect(s32 actor, s32 effect)
static void Event_PlayCue(s32 cue)
static void Map_CopyCells(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Map_SetShake(s32 horizontal, s32 vertical, s32 decay)
Sets shake amplitudes in fixed-point pixels and the per-frame decay factor.
#define MAP_CELL_STEPS_END
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_MapAnimateCells(const u16 *steps, s32 destX, s32 destY)
s32 Engine_MathCos(s32 angle)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_MapRedraw(void)
void Engine_ColorBufferInterpolate(s32 frames)
static void Camera_MoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_ActorSetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
static void Object_SetScript(struct FieldActor *object, const s32 *script)
static struct FieldActor * Actor_Get(s32 actor)
static void ColorBuffer_ApplySource(s32 value, s32 mode)
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
@ ACTOR_FOLLOWS_TERRAIN
moves with the ground height under it
@ ACTOR_FALLS
falls by its gravity and bounces
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
#define SCENE_TRANSITION(style, variant)
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define PSYNERGY_PHASE_ON_ACTOR(ability, phase)
A Psynergy event on an actor at one phase of the cast, as PSYNERGY_IN_AREA is for an area.
#define SCENE_EXITS(scene)
#define PSYNERGY_IN_AREA(ability, phase)
#define FIND_PSYNERGY_STONE
#define SCENE_EXIT(exit, scene, entrance)
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define EVENT_TOUCH_WALKING
#define TOUCH_WALKING_INTO(facing)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Event_End(void)
static void Camera_WaitForMove(void)
static void Task_Wait(s32 frames)
static void Event_Begin(void)
static void Actor_SetSpriteFlags(struct FieldActor *actor, s32 flags)
static void Actor_SetSpritePriority(s32 actor, s32 priority)
static void Event_Wait(s32 frames)
static void FieldObject_SetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
Game flags, named where their meaning is shown.
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_VENUS_LIGHTHOUSE_LIT
#define FLAG_VENUS_LIGHTHOUSE_BLOCK_CARRIED
Carry has set that block down beyond the wall.
#define FLAG_EXIT_ARRIVAL_PENDING
The leader left through an exit of kind 0x20 (SE_128, animation 26); the next scene plays the leader'...
#define FLAG_SCENE_TEMP_00
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_VENUS_LIGHTHOUSE_BLOCK_AT_WALL
Garet has said the block by the wall can go no farther.
#define FLAG_VENUS_LIGHTHOUSE_ATTACK_TOLD
The man at the entrance has told of the attack and is gone.
#define FLAG_SCENE_TEMP_01
#define FLAG_VENUS_LIGHTHOUSE_SECOND_PATH
#define FLAG_VENUS_LIGHTHOUSE_FIRST_PATH
The path the statue opened: the first or the second of its two.
volatile u32 gFrameCount
Frames WaitFrames has finished.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
struct EffectStep gMapCellBuffer[]
Map cells; battle effects reuse this as a particle array.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
The hardware's I/O registers and their bits, as pret names them.
Io_Write16, a 16-bit write to a register or memory.
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
Item numbers, named from the English release.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
s32 SceneData_ReturnZero(void)
static void Event_SearchLockedDoor(void)
Searching a cell door without the Cell Key: it stays shut.
Small statement macros both games use for positions, velocities and bounds.
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
Maps: their cells, layers, animations and blend scripts, and the map state.
void DisplayBlend_SuspendScript(void)
Suspends the blend script.
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LABEL(n)
Branch destination.
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_POS(x, y, z)
Set position.
#define SC_SYNC
Wait for arrival.
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
void Battle_ResetEffectCounter(void)
Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs i...
static s32 SceneActor_SetFlagBitByRelativeDepth(union FieldObject *fieldObject)
static void SceneActor_SwapPositionsByDepth(s32 first, s32 second)
Unless actor first is south of actor second, swaps their positions and waits a frame.
The fade overlay, the weather particles and the actor effect work.
struct FadeOverlayWork * gActorEffectWork
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
static s32 StagedActor_FillGridAttributeRectangle(u32 layer, s32 x, s32 z, u32 width, u32 height, s32 value)
Sets the collision code of a width by height rectangle of cells, from cell (x, z),...
Overlay objects and their records.
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
Scene numbers, named after their places.
char SceneId_VenusLighthouse1
char SceneId_VenusLighthouse4
char SceneId_VenusLighthouse5
char SceneId_VenusLighthouse2
char SceneId_VenusLighthouse6
char SceneId_VenusLighthouse3
The field object script interpreter and the operands its commands read.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
The pushable actors' movement probes and footprint bounds.
s16 animId
the sprite id whose metadata and frames it uses
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u8 lastNo
The animation number last selected, which selecting again skips.
struct AnimationEntry * entries[4]
its layers; empty ones null
u16 priority
2 when created
The way a drifting floor carries the party: -1, 0 or 1 on x and on z.
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s16 type
the object type to create; 222 without the flag
s32 targetScaleY
16.16 fixed point, 0x10000 full size
s32 targetScaleX
16.16 fixed point, 0x10000 full size
s32 palette
passed to ObjectGroup_SetChildValue
s32 startScaleY
16.16 fixed point, 0x10000 full size
s32 priority
the sprite's priority
u16 spin
1/65536 turns per frame
const s32 * script
the object script, run in mode 1
s32 startScaleX
16.16 fixed point, 0x10000 full size
void(*) update(union FieldObject *object)
replaces the update hook
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
struct FieldActor * viewCenter
the object the map view follows
s16 facingTrigger
the collision code ahead, which a search answers
s32 startTransition
SCENE_TRANSITION(style, variant).
s16 touchedTrigger
the step event a touch or exit event answers
struct FieldActor * placedActors[58]
the placed actors, from id 8
u16 message
the next message, advanced as each window opens
struct FieldActor * actor
the actor tracked; null draws nothing
A field actor: a person or thing on the field with a position, motion toward a target,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u8 steeringFlags
ActorSteeringFlag bits.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
u8 riseCounter
not read by the engine; scene code's own counter
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 velocityX
16.16 fixed-point pixels per frame
s32 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 terrainHeight
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
s32 gravity
Taken off the vertical velocity each frame while it is above the ground, in 16.16 fixed-point pixels ...
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
s32 velocityZ
16.16 fixed-point pixels per frame
u8 riseEnabled
not read by the engine; scene code's own state
u8 terrainId
The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the ce...
struct Vector3 velocity
Added to x, y and z each frame by the update hooks, in 16.16 fixed-point pixels per frame; FieldActor...
s32 z
16.16 fixed-point pixels
Full event work allocated by Field_RunScene (heap slot 27).
u16 busy
Set while a raised or touch event runs; FieldEvent_Begin then resets the effect counter.
s16 revealFrames
the frames Reveal has left
s32 selectedActor
the leader: its unit and its actor
One cell of a map layer: its metatile and flags, its collision code and an attribute indexing the col...
u8 collisionCode
The step code: 1 to 239 scene events, 240 and 241 encounter ground, 250 hazard, 252 to 254 for Field_...
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
The prefix that command handlers read from a field object's 0x70-byte slot.
A Venus Lighthouse switch or pillar socket's map cell.
Position record used by the shared radial-effect source below.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
void SetMapCellCollision(u32 layer, s32 x, s32 y, u32 collisionCode)
Sets the collision code of a layer's cell at (x, y) in 16.16 pixels.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct FieldEffect effect
#define VENUS_DESCENT_COLLISION_WIDTH
struct SceneEntrance gVenusLighthouseEntrances1[]
#define FLAG_VENUS_LIGHTHOUSE_THREE_BLOCK_GATE_OPEN
static void Event_EnterSparklingPassage(void)
Walking north into a sparkling passage: the leader dissolves in sparks and comes out at the passage's...
struct SceneEvent gVenusLighthouseEvents2[]
static void VenusLighthouse_EmitEastPassageParticles(void)
static void Event_ReadRelief(void)
Searching a relief shows its words; each relief has its own message, except in English,...
static void Event_HearOfTheAttack(void)
Talking to the man at the entrance (or reading his mind): he flickers away.
struct SceneEvent gVenusLighthouseEvents3[]
static void VenusLighthouse_ConfigurePassageEffect(struct FieldActor *object, s32 childValue)
Sets up a passage effect's motion, collision and child value.
static s32 VenusLighthouse_EmitPassageSparkTrail(union FieldObject *fieldObject)
static void Event_MoveCarryBlock(void)
Move on one of the two blocks by the gap: blocks still above the floor are solid again.
u32 gVenusLighthousePrimaryTable[]
static void Event_DriftSouth(void)
As Event_DriftNorth, south.
s32 gVenusPillarPushScript0_0[]
s32 gVenusSwitchPushScript2_0[]
s32 gVenusSwitchPushScript1_0[]
static void Event_StepOnWallSwitch(void)
Stepping on the floor switch: the wall slides aside in a cloud of dust, the first time only,...
s32 gVenusSwitchPushScript0_0[]
static void VenusLighthouse_StackFloatingBlock(s32 blockId)
Moves a floating block atop the highest support in its map cell.
static void VenusLighthouse_SpawnRandomParticles(s32 x, s32 z)
Emits the scheduled particles at the supplied passage coordinates.
static void Event_DriftWest(void)
As Event_DriftNorth, west.
static void VenusLighthouse_RestoreScriptedChildValues(void)
Restores child values encoded in the placed actors' script timers.
s32 gVenusLighthousePlacements6_3[]
s32 gVenusPillarPushScript4_0[]
s32 gVenusPillarPushScript5_1[]
struct SwitchCell gVenusSwitchCells[]
static __inline__ void FloatingBlock_Settle(struct FieldActor *block, s32 resetValue)
Stops a floating block and resets its vertical motion and timer.
s32 * gVenusPillarPushScript5[]
s32 * gVenusPillarPushScript2[]
struct ScenePlacement gVenusLighthousePlacements6[]
const u8 * gVenusPillarShapes[]
s32 gVenusSwitchPushScript3_1[]
s32 * gVenusSwitchPushScript0[]
u8 gVenusShapesPushedLeft[]
s32 gVenusSettleScriptB[]
struct SceneEvent gVenusLighthouseEvents1[]
s32 ** gVenusPillarPushScripts[]
#define VENUS_LIGHTHOUSE_RUN_OPENING_SEQUENCE
const u32 * SceneData_GetPrimaryTable(void)
Returns the packed exits shared by the lighthouse scenes.
s32 gVenusLighthousePlacements5_3[]
s32 * gVenusSwitchPushScript3[]
s32 gVenusPillarPushScript7_0[]
#define VENUS_LIGHTHOUSE_FIXED_OFFSET(value, bits)
static void Event_PushPuzzleBlock(void)
Pushing a block in the pillar room.
s32 gVenusRefusedPushScript[]
static s32 VenusLighthouse_UpdateChildFromTimer(struct ScriptInterpreter *interpreter)
Applies the current script timer's child value and advances the script.
static void Event_TalkToWaitingScholar(void)
Talking to the scholar who has waited to see inside Venus Lighthouse.
static s32 VenusLighthouse_EmitGateParticles(union FieldObject *fieldObject)
#define FLAG_VENUS_LIGHTHOUSE_SOCKETS_B
static void Event_StepOnWestWallSwitch(void)
Stepping on the west floor switch: the west wall slides aside, the first time only,...
struct SceneEntrance gVenusLighthouseEntrances5[]
static void Event_EnterRisingPassage(void)
Walking south into the passage: the leader rises out of the room to the floor above.
s32 gVenusLighthousePlacements5_2[]
struct ScenePlacement gVenusLighthousePlacements2[]
static struct FieldActor * VenusLighthouse_CreateScriptedGateEffect(s32 x, s32 z, const s32 *script)
Creates a scripted gate effect at the supplied pixel coordinates.
s32 * gVenusPillarPushScript1[]
s32 gVenusLighthousePlacements2_1[]
static s32 VenusLighthouse_ClearScriptedSpriteFlags(struct ScriptInterpreter *interpreter)
Clears the scripted actor's sprite flags and advances its script.
s32 * gVenusPillarPushScript3[]
s32 gVenusPillarPushScript6_0[]
#define FLAG_VENUS_LIGHTHOUSE_SOCKETS_A
static void VenusLighthouse_FixBlockAtDestination(struct FieldActor *block)
Fixes a block at its destination and restores the cell beneath it.
s32 gVenusLighthousePlacements2_0[]
static void Event_MoveSwitchBlock(void)
Move on one of the three blocks: a block on a free socket sinks in, and with all three sunk the gate ...
s32 gVenusPillarPushScript5_0[]
static struct FieldActor * VenusLighthouse_CreateBlendedPassageEffect(s32 x, s32 y, s32 z, s32 type)
Creates a blended passage effect behind the actors.
struct SceneEntrance gVenusLighthouseEntrancesOther[]
s32 * gVenusSwitchPushScript2[]
s32 * gVenusPillarPushScript6[]
static void Event_JumpDown(void)
Walking off the ledge before the floor switch is held down: the leader jumps down to the floor below ...
static void Event_SetLeaderAsEffectTarget(void)
Stepping onto this spot makes the leader the actor the room's effect follows.
static void VenusLighthouse_PushAdjacentBlock(void)
Pushes the adjacent block only when its destination and overhead space are clear.
s32 * gVenusPillarPushScript4[]
struct ScenePlacement gVenusLighthousePlacements4[]
static void Event_HidePath(void)
Reveal fading: the hidden path disappears again.
s32 gVenusSettleScriptA[]
static void Event_JumpOrPushGateBlock(void)
Walking into the gap or the block before the gate: jump the gap, else push the block,...
struct ScenePlacement gVenusLighthousePlacements3[]
s32 Scene_RunEntrySetup(void)
Restores puzzle progress, actors and entrance effects for all six scenes.
#define FLAG_VENUS_LIGHTHOUSE_GATE_OPEN
s32 gVenusLighthousePlacements4_1[]
struct SceneEntrance gVenusLighthouseEntrances4[]
static void Event_CarryBlockAcrossGap(void)
Carry on one of the two blocks: set down in its place it stays fixed; dropped into the gap it falls t...
static void Event_PushDepthBlock(void)
Pushing one of the three blocks in a row.
static void Event_FallThroughFloor(void)
Stepping onto the hole in the floor: the leader looks down, falls through and lands in the room below...
s32 gVenusFirstGateScript[]
#define FLAG_VENUS_LIGHTHOUSE_PILLAR_GATE_OPEN
static void VenusLighthouse_AnimatePairedTileWaves(void)
Animates the two tile waves before taking the linked passage exit.
static void VenusLighthouse_AnimateEastTileWave(void)
Animates the eastern tile wave and starts its lingering particle task.
static void Event_MoveDepthBlock(void)
Move on one of the three blocks in a row: the floor under each block is solid again and the nearer bl...
static void Event_DriftEast(void)
As Event_DriftNorth, east.
s32 gVenusSwitchPushScript3_0[]
static void Event_CarryBlockPastWall(void)
Carry on the block Move could not push past the wall: once it is set down beyond, it stays there (FLA...
s32 ** gVenusSwitchPushScripts[]
struct SceneEvent gVenusLighthouseEvents4[]
static s32 VenusLighthouse_UpdateRisingSpray(union FieldObject *fieldObject)
s32 gVenusSecondGateScript[]
static void Event_TalkToScholarByDoor(void)
Talking to the scholar by the door: he explored once it opened, until Kraden and the others appeared;...
s32 gVenusLighthousePlacements5_1[]
static void Event_MovePillarSwitchBlock(void)
Move on one of the four blocks in the pillar room: on a free socket it sinks in, and with all four su...
static void Event_StepOnEastWallSwitch(void)
Stepping on the east floor switch: the east wall slides aside, the first time only,...
s32 gVenusLighthousePlacements3_Data[]
static void VenusLighthouse_ArriveThroughSparkPassage(void)
Brings the leader out of a sparkling passage on a fresh entrance.
struct ScenePlacement gVenusLighthousePlacementsOther[]
static s32 Event_JumpAcrossGap(void)
Walking into a one-tile gap: the leader jumps it if the far side is clear.
static void VenusLighthouse_PrepareStandingActor(s32 actorId)
Prepares a stationary actor with the room's initial collision and draw state.
struct ScenePlacement gVenusLighthousePlacements5[]
u8 gVenusShapesPushedRight[]
#define VENUS_DESCENT_COLLISION_X
static void VenusLighthouse_StepActorWithDust(struct DirXZ *direction)
Follows the selected actor through the passage, adjusting for walls and drops.
static __inline__ void Rubble_SetScaleAndSpin(struct EffectOptions *options)
Chooses the particle scales and spin used by the tile-wave animations.
s32 * gVenusPillarPushScript7[]
static void Event_DriftNorth(void)
Standing on this floor carries the party north in a trail of dust; at a ledge they drop down.
static void Event_MoveGateBlock(void)
Move on the block before the gate: in its socket it sinks in and the gate opens, the first time only.
static s32 VenusLighthouse_FollowSupportingBlockHeight(union FieldObject *fieldObject)
struct SceneEvent gVenusLighthouseEvents5[]
static __inline__ void Actor_CopyPosition(struct FieldActor *destination, struct FieldActor *source)
Copies all three fixed-point position components without changing motion.
s32 gVenusLeaderApproachScript[]
static void Event_JumpOrPushSwitchBlock(void)
Walking into the gap or one of the three blocks: jump the gap, else push the block,...
static s32 VenusLighthouse_EmitRisingParticles(union FieldObject *fieldObject)
static struct FieldActor * VenusLighthouse_CreateOccludingPassageEffect(s32 x, s32 y, s32 z, s32 type)
Creates a passage effect that preserves the overlapping actors' draw order.
s32 gVenusFirstGateOpenScript[]
#define FLAG_VENUS_LIGHTHOUSE_WALL_MOVED
s32 gVenusSwitchPushScript1_1[]
static void Event_LiftCarryBlock(void)
Move or Carry starting on one of the two blocks by the gap: their tiles are marked before they move.
u8 gVenusShapesPushedUp[]
static void Event_JumpOrPushCarryBlock(void)
Walking into a gap or a block by it: jump the gap, else push the block.
static void VenusLighthouse_LandWithRadialDust(void)
Drops the leader onto the floor and emits the radial landing dust.
static void Event_SearchStatue(void)
Searching the statue: the room flashes and the path it opens changes, and the camera shows it.
s32 * gVenusSwitchPushScript1[]
s32 gVenusPillarPushScript3_0[]
static void VenusLighthouse_VisitPillarActors(void)
Visits the four pillar actors through the object lookup service.
struct SwitchCell gVenusPillarCells[]
static void VenusLighthouse_RaiseLeaderWithSpray(void)
Lands the leader on the spray, then raises both toward the exit.
static void VenusLighthouse_ReleaseFallenCarryBlock(struct FieldActor *block)
Removes a fallen Carry block, or restores collision under the remaining blocks.
struct ScenePlacement gVenusLighthousePlacements1[]
#define FLAG_VENUS_LIGHTHOUSE_EAST_WALL_MOVED
static void Event_MoveBlockTowardWall(void)
Move on the block by the wall: once it reaches the wall, the first time only, Garet comes out.
static void Event_StepOnFloorSwitch(void)
Standing on the floor switch presses it; stepping off releases it.
s32 gVenusLighthousePlacements6_4[]
static void Event_ClearEffectTarget(void)
Stepping onto this spot: the room's effect follows no one.
const u8 * gVenusSwitchShapes[]
static s32 VenusLighthouse_PulseChildEffect(union FieldObject *fieldObject)
static void VenusLighthouse_EmitWestPassageParticles(void)
s32 gVenusPillarPushScript2_0[]
static void VenusLighthouse_AnimateWestTileWave(void)
Animates the western tile wave and starts its lingering particle task.
#define FLAG_VENUS_LIGHTHOUSE_WEST_WALL_MOVED
s32 gVenusSwitchPushScript0_1[]
static void Event_CarryFloatingBlock(void)
Carry on one of the four floating blocks: it settles where it is set down and the platforms under the...
static __inline__ void SetFlagBits(u8 *flags, u8 bits)
struct SceneEntrance gVenusLighthouseEntrances3[]
s32 gVenusSwitchPushScript2_1[]
struct SceneEntrance gVenusLighthouseEntrances6[]
s32 * gVenusPillarPushScript0[]
static void Event_JumpOrPushPillarBlock(void)
Walking into the gap or a pillar-room block: jump the gap, else push the block, which may sink into a...
static s32 VenusLighthouse_DispatchPushScript(struct ScriptInterpreter *interpreter)
Selects the block's push script from its direction, support animation and socket.
static void Event_MoveBlockOntoSwitch(void)
Move on the block by the floor switch: on the switch it sinks in and holds it down.
static void Event_RevealPath(void)
Reveal: the hidden path appears and can be walked on.
u8 gVenusShapesPushedDown[]
struct SceneEvent gVenusLighthouseEvents6[]
static void VenusLighthouse_LowerFloatingBlocks(s32 waitFrames)
Moves the floating supports to the heights selected by their timers.
static void Event_PushBlockTowardWall(void)
Pushing the block by the wall: as Move, with Garet's remark at the wall.