43#include "text/msg_ids.h"
138#define PAIRED_PATROL_LAYER_ORIGIN_X (136.0 * 65536)
235 if (columnActor != 0) {
262 if ((columnActor->
z.
fixed >> 20) > 22) {
269 if (columnActor !=
NULL) {
290 Map_CopyCells(doorCellX, doorCellY - 0x30, 1, 1, doorCellX, doorCellY - 0x2e);
325 collisionCellY = doorCellY - 44;
356 Map_CopyCells(doorCellX, doorCellY - 0x3f, 1, 1, doorCellX, doorCellY - 0x3e);
492 s32 leaderTileZ, leaderTileX;
494 if (leaderFixedZ < 0) {
495 leaderFixedZ += 0xfffff;
497 leaderFixedX = leader->
x.
fixed;
498 leaderTileZ = leaderFixedZ >> 20;
499 if (leaderFixedX < 0) {
500 leaderFixedX += 0xfffff;
502 leaderTileX = leaderFixedX >> 20;
503 if ((
u32)(leaderTileZ - 5) <= 2 && leaderTileX <= 10) {
506 if ((
u32)(leaderTileX - 8) <= 1 && leaderTileZ > 22) {
516#define PATROL_PSYNERGY_REQUEST(work) ((work)->command)
517#define PATROL_ITEM_REQUEST(work) ((work)->item)
518#define PATROL_RAISED_TRIGGER(work) ((work)->event)
520#define PATROL_PSYNERGY_REQUEST(work) ((work)[191])
521#define PATROL_ITEM_REQUEST(work) ((work)[192])
522#define PATROL_RAISED_TRIGGER(work) ((work)[193])
610 s32 leaderTileX, guardTileZ, guardTileX;
612 if (leaderFixedX < 0) {
613 leaderFixedX += 0xfffff;
615 leaderTileX = leaderFixedX >> 20;
616 guardFixedZ = guard->
z.
fixed;
617 if (guardFixedZ < 0) {
618 guardFixedZ += 0xfffff;
620 guardFixedX = guard->
x.
fixed;
621 guardTileZ = guardFixedZ >> 20;
622 if (guardFixedX < 0) {
623 guardFixedX += 0xfffff;
625 guardTileX = guardFixedX >> 20;
626 if (leaderTileX == 52 && guardTileX == 57 && guardTileZ > 34 &&
630 if (leaderTileX == 57 && guardTileX == 52 && guardTileZ > 34 &&
699 s32 leaderTileZ = leader->
z.
fixed / 0x100000;
700 s32 leaderTileX = leader->
x.
fixed / 0x100000;
702 if ((
u32)(leaderTileX - 41) <= 3 && leaderTileZ > 25 && leaderTileZ <= 28) {
705 if (leaderTileX == 41 && leaderTileZ > 37 && leaderTileZ <= 41) {
708 if ((
u32)(leaderTileX - 54) <= 2 && leaderTileZ > 30 && leaderTileZ <= 40) {
774 s32 leaderTileZ = leader->
z.
fixed / 0x100000;
775 s32 leaderTileX = leader->
x.
fixed / 0x100000;
777 if (leaderTileX > 45 && leaderTileZ > 14 && leaderTileX <= 64 &&
872 s32 guardTileZ = guard->
z.
fixed / 0x100000;
873 s32 guardTileX = guard->
x.
fixed / 0x100000;
874 s32 leaderTileZ = leader->
z.
fixed / 0x100000;
875 s32 leaderTileX = leader->
x.
fixed / 0x100000;
876 s32 zDistance = guardTileZ - leaderTileZ;
878 if (zDistance >= -6 && zDistance <= 6 && guardTileX - 1 < leaderTileX &&
879 guardTileX + 1 > leaderTileX) {
889 s32 guardTileZ = guard->
z.
fixed / 0x100000;
890 s32 guardTileX = guard->
x.
fixed / 0x100000;
891 s32 leaderTileZ = leader->
z.
fixed / 0x100000;
892 s32 leaderTileX = leader->
x.
fixed / 0x100000;
893 s32 xDistance = guardTileX - leaderTileX;
895 if (xDistance < -6 || xDistance > 6) {
898 if (guardTileZ - 2 < leaderTileZ && guardTileZ + 2 > leaderTileZ) {
913 s32 inHorizontalSight =
916 return (
u32)(inHorizontalSight | -inHorizontalSight) >> 31;
925 s32 guardTileZ = guard->
z.
fixed / 0x100000;
926 s32 guardTileX = guard->
x.
fixed / 0x100000;
927 s32 leaderTileZ = leader->
z.
fixed / 0x100000;
928 s32 leaderTileX = leader->
x.
fixed / 0x100000;
929 s32 xDistance = guardTileX - leaderTileX;
934 xDistance = -xDistance;
936 zDistance = guardTileZ - leaderTileZ;
938 zDistance = -zDistance;
940 if (xDistance + zDistance <= 4) {
951 s32 guardTileX = guard->
x.
fixed / 0x100000;
952 s32 guardTileZ = guard->
z.
fixed / 0x100000;
953 s32 viewTileX = viewCenter->
x.
fixed / 0x100000;
954 s32 viewTileZ = viewCenter->
z.
fixed / 0x100000;
955 s32 xDistance = guardTileX - viewTileX;
959 xDistance = -xDistance;
961 zDistance = guardTileZ - viewTileZ;
963 zDistance = -zDistance;
965 if (xDistance > 7 || zDistance > 5) {
978 s32 playerX = leader->
x.
fixed / 0x100000;
979 s32 playerZ = leader->
z.
fixed / 0x100000;
981 if (playerX == 43 && playerZ > 28 && playerZ <= 31) {
985 *touchedTrigger = doorTrigger;
998 s32 playerX = leader->
x.
fixed / 0x100000;
999 s32 playerZ = leader->
z.
fixed / 0x100000;
1001 if (playerX == 16 && playerZ > 55 && playerZ <= 58 &&
1002 (leader->
facing == 0xc000 || leader->
facing == 0x4000)) {
1006 *touchedTrigger = doorTrigger;
1021 s32 challengeMessage = MsgLunpaWho2;
1051 s32 challengeMessage = MsgLunpaWho2;
1096 messageBase = MsgLunpaIntruder;
1110 s32 messageBase = MsgLunpaGuardWhosThat;
1126 messageBase = MsgLunpaShiftAlready;
1143 s32 messageBase = MsgLunpaScoundrel;
1203 messageBase = MsgLunpaWho3;
1294 s32 challengeMessage = MsgLunpaWho2;
1312 s32 challengeMessage;
1323 challengeMessage = MsgLunpaWho2;
1355static __inline__
void
1357 void (*openPassage)(
void)) {
1439 if (leader !=
NULL) {
1443 if (leader !=
NULL) {
1447 if (leader !=
NULL) {
1551 messageBase = MsgLunpaBackMoreGuess;
1588 messageBase = MsgLunpaTimeEat;
1793 s32 aftermathMessage;
1794 s32 punishmentMessage;
1826 aftermathMessage = MsgLunpaUhnnGetOff;
2009 punishmentMessage = MsgLunpaAbleGet;
2168 donpaMessage = MsgLunpaDad;
2517 messageBase = MsgLunpaLeftGuardHearsSomeone;
2548 whisperMessage = MsgLunpaShhhPleaseDont;
2577 familyMessage = MsgLunpaDonpaKnowsCoddled;
2622 rewardMessage = MsgLunpaThankHelpDodonpa;
2728 frightMessage = MsgLunpaWhWhWho;
2738 purposeMessage = MsgLunpaDontLookNearly;
2767 *psynergyRequest = 0;
2778 s32 pleaMessage = MsgLunpaWrongTurnOver;
2815 if (sceneActor != 0)
2819 if (sceneActor != 0)
2823 if (sceneActor != 0)
2844 if (sceneActor != 0)
2847 sceneActor->
scaleX = 0xcccc;
2989 keyActor->
scaleX = 0xc000;
2990 keyActor->
scaleY = 0xc000;
3025 if (sceneActor != 0) {
3029 if (sceneActor != 0) {
3033 if (sceneActor != 0) {
3037 if (sceneActor != 0) {
3042 if (sceneActor != 0) {
3108#define DIRECTION_STEP(dx, dz) (((u32)(dx) << 16) | ((u32)(dz) & 0xffff))
3124 207, 205, 228, 229, 298, 297,
3236 { 0,
CONDITION_ALWAYS, 168, 0, 632,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
3237 { 1,
CONDITION_ALWAYS, 160, 0, 168,
FACING_NORTH, 0, 40, 24, 296, 280, 0 },
3238 { 2,
CONDITION_ALWAYS, 160, 0, 104,
FACING_SOUTH, 0, 40, 24, 296, 280, 0 },
3239 { 3,
CONDITION_ALWAYS, 272, 0, 896,
FACING_NORTH, 0, 24, 616, 536, 936, 0 },
3240 { 4,
CONDITION_ALWAYS, 376, 0, 896,
FACING_NORTH, 0, 24, 616, 536, 936, 0 },
3241 { 5,
CONDITION_ALWAYS, 248, 0, 856,
FACING_SOUTH, 0, 24, 616, 536, 936, 0 },
3242 { 6,
CONDITION_ALWAYS, 488, 0, 680,
FACING_SOUTH, 0, 24, 616, 536, 936, 0 },
3243 { 7,
CONDITION_ALWAYS, 72, 0, 696,
FACING_SOUTH, 0, 24, 616, 536, 936, 0 },
3244 { 8,
CONDITION_ALWAYS, 96, 0, 856,
FACING_SOUTH, 0, 24, 616, 536, 936, 0 },
3245 { 9,
CONDITION_ALWAYS, 376, 0, 184,
FACING_SOUTH, 0, 328, 8, 568, 232, 0 },
3246 { 10,
CONDITION_ALWAYS, 504, 0, 88,
FACING_SOUTH, 0, 328, 8, 568, 232, 0 },
3247 { 11,
CONDITION_ALWAYS, 440, 0, 104,
FACING_SOUTH, 0, 328, 8, 568, 232, 0 },
3248 { 12,
CONDITION_ALWAYS, 136, 0, 512,
FACING_NORTH, 0, 40, 328, 280, 552, 0 },
3249 { 13,
CONDITION_ALWAYS, 888, 0, 280,
FACING_NORTH, 0, 632, 40, 952, 328, 0 },
3250 { 14,
CONDITION_ALWAYS, 696, 0, 264,
FACING_SOUTH, 0, 632, 40, 952, 328, 0 },
3251 { 15,
CONDITION_ALWAYS, 824, 0, 120,
FACING_SOUTH, 0, 632, 40, 952, 328, 0 },
3252 { 16,
CONDITION_ALWAYS, 664, 0, 632,
FACING_NORTH, 0, 616, 344, 936, 696, 0 },
3253 { 17,
CONDITION_ALWAYS, 888, 0, 520,
FACING_NORTH, 0, 616, 344, 936, 696, 0 },
3254 { 18,
CONDITION_ALWAYS, 696, 0, 432,
FACING_SOUTH, 0, 616, 344, 936, 696, 0 },
3255 { 19,
CONDITION_ALWAYS, 440, 0, 448,
FACING_NORTH, 0, 320, 312, 560, 504, 0 },
3256 { 20,
CONDITION_ALWAYS, 696, 0, 824,
FACING_NORTH, 0, 616, 744, 856, 952, 0 },
3261 { 0,
CONDITION_ALWAYS, 168, 0, 632,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
3262 { 1,
CONDITION_ALWAYS, 136, 0, 392,
FACING_SOUTH, 0, 40, 8, 308, 448, 0 },
3263 { 2,
CONDITION_ALWAYS, 136, 0, 80,
FACING_SOUTH, 0, 40, 8, 308, 448, 0 },
3264 { 3,
CONDITION_ALWAYS, 264, 0, 416,
FACING_SOUTH, 0, 40, 8, 308, 448, 0 },
3265 { 4,
CONDITION_ALWAYS, 376, 0, 232,
FACING_NORTH, 0, 328, 8, 568, 272, 0 },
3266 { 5,
CONDITION_ALWAYS, 504, 0, 104,
FACING_NORTH, 0, 328, 8, 568, 272, 0 },
3267 { 6,
CONDITION_ALWAYS, 376, 0, 176,
FACING_SOUTH, 0, 328, 8, 568, 272, 0 },
3268 { 7,
CONDITION_ALWAYS, 408, 0, 456,
FACING_NORTH, 0, 328, 272, 584, 512, 0 },
3269 { 8,
CONDITION_ALWAYS, 456, 0, 352,
FACING_SOUTH, 0, 328, 272, 584, 512, 0 },
3270 { 9,
CONDITION_ALWAYS, 504, 0, 456,
FACING_NORTH, 0, 328, 272, 584, 512, 0 },
3271 { 10,
CONDITION_ALWAYS, 136, 0, 640,
FACING_NORTH, 0, 16, 472, 256, 688, 0 },
3272 { 11,
CONDITION_ALWAYS, 648, 0, 72,
FACING_SOUTH, 0, 568, 16, 808, 176, 0 },
3273 { 12,
CONDITION_ALWAYS, 744, 0, 80,
FACING_SOUTH, 0, 568, 16, 808, 176, 0 },
3274 { 13,
CONDITION_ALWAYS, 696, 0, 376,
FACING_NORTH, 0, 576, 264, 816, 432, 0 },
3275 { 14,
CONDITION_ALWAYS, 200, 0, 848,
FACING_SOUTH, 0, 152, 680, 424, 992, 0 },
3276 { 15,
CONDITION_ALWAYS, 264, 0, 776,
FACING_SOUTH, 0, 152, 680, 424, 992, 0 },
3277 { 16,
CONDITION_ALWAYS, 376, 0, 824,
FACING_SOUTH, 0, 152, 680, 424, 992, 0 },
3278 { 17,
CONDITION_ALWAYS, 536, 0, 696,
FACING_NORTH, 0, 488, 584, 760, 896, 0 },
3279 { 18,
CONDITION_ALWAYS, 680, 0, 832,
FACING_SOUTH, 0, 488, 584, 760, 896, 0 },
3280 { 19,
CONDITION_ALWAYS, 712, 0, 856,
FACING_NORTH, 0, 488, 584, 760, 896, 0 },
3281 { 20,
CONDITION_ALWAYS, 912, 0, 192,
FACING_NORTH, 0, 784, 24, 1024, 240, 0 },
3282 { 21,
CONDITION_ALWAYS, 840, 0, 664,
FACING_NORTH, 0, 768, 440, 1008, 704, 0 },
3283 { 22,
CONDITION_ALWAYS, 952, 0, 528,
FACING_SOUTH, 0, 768, 440, 1008, 704, 0 },
3284 { 23,
CONDITION_ALWAYS, 872, 0, 376,
FACING_NORTH, 0, 768, 264, 1016, 432, 0 },
3285 { 24,
CONDITION_ALWAYS, 904, 0, 112,
FACING_SOUTH, 0, 784, 24, 1024, 240, 0 },
3286 { 30,
CONDITION_ALWAYS, 408, 0, 456,
FACING_NORTH, 0, 328, 272, 584, 512, 0 },
3287 { 31,
CONDITION_ALWAYS, 648, 0, 88,
FACING_NORTH, 0, 568, 16, 808, 176, 0 },
3292 { 0,
CONDITION_ALWAYS, 168, 0, 632,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
3293 { 1,
CONDITION_ALWAYS, 424, 0, 584,
FACING_SOUTH, 0, 200, 488, 480, 648, 0 },
3294 { 2,
CONDITION_ALWAYS, 344, 0, 568,
FACING_SOUTH, 0, 200, 488, 480, 648, 0 },
3295 { 3,
CONDITION_ALWAYS, 312, 0, 448,
FACING_NORTH, 0, 8, 8, 568, 480, 0 },
3296 { 4,
CONDITION_ALWAYS, 440, 0, 296,
FACING_SOUTH, 0, 8, 8, 568, 480, 0 },
3297 { 5,
CONDITION_ALWAYS, 312, 0, 248,
FACING_SOUTH, 0, 8, 8, 568, 480, 0 },
3298 { 6,
CONDITION_ALWAYS, 104, 0, 184,
FACING_SOUTH, 0, 8, 8, 568, 480, 0 },
3303 { 0,
CONDITION_ALWAYS, 168, 0, 632,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
3304 { 1,
CONDITION_ALWAYS, 56, 0, 328,
FACING_NORTH, 0, 8, 8, 264, 424, 0 },
3305 { 2,
CONDITION_ALWAYS, 184, 0, 368,
FACING_NORTH, 0, 8, 8, 264, 424, 0 },
3306 { 3,
CONDITION_ALWAYS, 328, 0, 344,
FACING_SOUTH, 0, 288, 32, 576, 432, 0 },
3307 { 4,
CONDITION_ALWAYS, 440, 0, 224,
FACING_NORTH, 0, 288, 32, 576, 432, 0 },
3704 13, 56, 8, 56, 3, 56, 28, 85,
3709 31, 61, 15, 57, 6, 61,
Ability numbers, named from the English release.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
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)
const u32 * Scene_GetExits(void)
Both scenes share one exit table.
const struct SceneRegion * Scene_GetRegions(void)
s32 Scene_Initialize(void)
Sets up whichever scene is being entered and runs its arrival events.
s32 gStagedActor_DirectionSteps[]
Pixel step by direction: X in the upper halfword, Z in the lower.
s32 gStagedActor_FootprintBounds[]
#define DIRECTION_STEP(dx, dz)
Pixel step by direction: X in the upper halfword, Z in the lower.
u32 gStagedActor_FootprintKinds[]
The engine calls the debug menus import, and their palette swatch tiles.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
Scene commands: the all-caps macros the scene scripts are written in.
#define OBJ_DIR(no, d, t)
#define OBJ_POS_SET(no, x, z)
#define MESSAGE_OPEN(no, f)
#define OBJ_WALK(no, x, z)
#define MESSAGE_PUT(no, f)
#define OBJ_FACE(no, to, t)
#define OBJ_EMOTE(no, e, t)
#define OBJ_SPEED(no, s, a)
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
static void Actor_SetDestination(s32 actor, s32 x, s32 z)
void Engine_MapCopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Engine_ActorSetSpritePriority(s32 actor, s32 priority)
static void Actor_SetBuiltinAction(s32 actor, s32 action)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_CameraMoveToActor(s32 actor, s32 pan)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
void Engine_ItemShowFound(s32 item, s32 height)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
void Engine_PsynergyCancel(void)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
void Engine_ActorWaitForMove(s32 actor)
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
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.
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
struct FieldActor * Engine_EventGetViewCenter(void)
void Engine_MapRedraw(void)
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)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
static struct FieldActor * Actor_Get(s32 actor)
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
#define SCENE_TRANSITION(style, variant)
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EXITS(scene)
#define PSYNERGY_IN_AREA(ability, phase)
@ SCENE_LUNPA_FORTRESS_GATE
#define SCENE_EXIT(exit, scene, entrance)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define TOUCH_FACING(facing)
#define FIND_COINS(coins)
static s32 Task_AddCallback(void(*callback)(void), s32 priority)
Calls the main-image scheduler through engine_call.h.
Game flags, named where their meaning is shown.
#define FLAG_SCENE_TEMP_70
#define FLAG_SCENE_TEMP_15
#define FLAG_LUNPA_FORTRESS_THREE_GUARDS_BEATEN
#define FLAG_SCENE_TEMP_27
#define FLAG_LUNPA_FORTRESS_HALL_GUARD_BEATEN
#define FLAG_LUNPA_TRADE_REOPENED
#define FLAG_LUNPA_FORTRESS_COLUMN_LOWERED
#define FLAG_LUNPA_FORTRESS_REWARD_TAKEN
Donpa's reward, the Djinni in his room, has joined the party.
#define FLAG_LUNPA_FORTRESS_FIRST_SWITCH_UNCOVERED
Whirlwind has blown away what hid the first switch, the passage and the second switch.
#define FLAG_SCENE_TEMP_25
#define FLAG_LUNPA_FORTRESS_CHEST_POWER_BREAD
#define FLAG_LUNPA_FORTRESS_CHEST_COINS
#define FLAG_SCENE_TEMP_17
#define FLAG_LUNPA_FORTRESS_SECOND_SWITCH_FLIPPED
#define FLAG_LUNPA_FORTRESS_CELL_KEY
caught or taken from its hook
#define FLAG_LUNPA_FORTRESS_WEST_GUARD_BEATEN
#define FLAG_LUNPA_FORTRESS_THIRD_CHEST
item 0xaa
#define FLAG_LUNPA_FORTRESS_FIRST_SWITCH_FLIPPED
#define FLAG_SCENE_TEMP_18
#define FLAG_LUNPA_FORTRESS_TRAP_SEEN
The party has seen Hammet's rescue up to Dodonpa's trap; a retry after losing the battle skips to the...
#define FLAG_SCENE_TEMP_26
#define FLAG_SCENE_TEMP_24
#define FLAG_LUNPA_FORTRESS_PASSAGE_UNCOVERED
#define FLAG_MENU_OPEN
Set while the field menu is open; scenes hold their moving actors still.
#define FLAG_LUNPA_FORTRESS_CHEST_ELIXIR
#define FLAG_LUNPA_FORTRESS_SECOND_SWITCH_UNCOVERED
#define FLAG_SCENE_TEMP_14
#define FLAG_LUNPA_FORTRESS_CHEST_LUCKY_MEDAL
#define FLAG_LUNPA_FORTRESS_BARREL_VIAL
#define FLAG_LUNPA_FORTRESS_EAST_GUARD_BEATEN
volatile u32 gFrameCount
Frames WaitFrames has finished.
GameState, the game's state: play time, coins, the scene and the leader's position,...
#define Battle_SetStart(mode)
Sets the battle start type.
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
void Engine_EventSetNextDestination(s32 first, s32 second)
void Engine_BattleFxSetWeightedResult(s32 zone_no, s32 slot_no)
void Engine_MapSetWorkFlagBits9To11(u32 v)
void Engine_BattleFxRunPageEffectForSlot(s32 slot, s32 element, s32 djinn)
s32 Engine_BattleFxPlayCueAndStartEmitterOnTarget(s32 effect, s32 target, s32 mode)
s32 Engine_PartyInventoryFindOwner(s32 item_id)
Item numbers, named from the English release.
static void LunpaFortress_RestoreGuardRoomDoors(void)
The guard rooms' cell doors stay open.
static void Event_UnlockColumnRoomDoor(void)
Facing a column room cell door with the Cell Key: it opens with a rumble.
static void LunpaFortress_CheckUpperHallGuard(void)
Every frame in the upper hall: the guard who sees the uncloaked leader raises TRIGGER_UPPER_HALL_SPOT...
s32 gLunpaFortressRandomPick
struct SceneEvent gLunpaFortressNoEvents[]
static void Event_FlipFirstSwitch(void)
Searching the first switch while Reveal shows it flips it, and its passage opens.
static void LunpaFortress_OpenFirstSwitchPassage(void)
The first switch's passage opens.
#define PATROL_RAISED_TRIGGER(work)
struct ScenePlacement gLunpaFortressPlacements1[]
static void LunpaFortress_InitializeOuterRooms(void)
Sets the outer rooms up by entrance: the guards that watch each part, and the cell doors already open...
static void Event_PushColumn(void)
Pushing the column: it slides one cell along.
static void Event_FightWestGuard(void)
Walking up to the west guard: he challenges the party to a battle, and is gone after it.
static void LunpaFortress_CheckEntranceGuard(void)
Every frame past the entrance: the guard who sees the uncloaked leader raises TRIGGER_ENTRANCE_GUARD_...
static void LunpaFortress_ActOutGuardShiftDialogue(s32 actorId)
A guard expects his relief, then sees who it is. "Is my shift up already?".
u32 gLunpaFortressExits2[]
static void UNUSED LunpaFortress_DoNothingA(void)
static s32 LunpaFortress_TryCollectDisplayedItem(s32 actorId, s32 itemId)
Gives the item an actor shows, with its effect; with no room for it, the actor shows the item is left...
static void Event_TalkToBeatenGuardB(void)
The second of the beaten guards gives up, and Hammet is in the cave.
@ TRIGGER_UPPER_HALL_SPOTTED
@ TRIGGER_ENTRANCE_GUARD_SPOTTED
@ TRIGGER_SENTRIES_SPOTTED
@ TRIGGER_OUTER_PATROL_SPOTTED
@ TRIGGER_HALL_PATROL_SPOTTED
@ TRIGGER_PATROL_PAIR_SPOTTED
u32 gColumnRoomDoorCells[]
static void Event_TalkToBeatenGuardA(void)
The first of the beaten guards marvels at the party.
static s32 LunpaFortress_IsLeaderPassingPatrollingGuard(void)
Whether the leader and the hall patrol are in the two parallel corridors, where the guard passes with...
struct ScenePlacement gLunpaFortressPlacements3[]
static void UNUSED LunpaFortress_DoNothingF(void)
static void LunpaFortress_ActOutIntruderDialogue(s32 actorId)
A guard spots an intruder. "Hey! Intruder!".
static void Event_ReadAttendantsThoughts(void)
Mind Read on Donpa's attendant.
static __inline__ void LunpaFortress_FlipHiddenSwitch(s32 cellX, s32 cellY, void(*openPassage)(void))
A switch flips in two frames, then its passage opens.
@ GUARD_ROOM_FIRST_PATROL
@ GUARD_ROOM_GUARD_A
The three guards who fight together.
@ GUARD_ROOM_SECOND_PATROL
struct SceneEvent gLunpaFortressEvents1[]
static void Event_UnlockGuardRoomDoor(void)
Facing a guard room cell door with the Cell Key: it opens with a rumble.
static void LunpaFortress_LowerColumn(void)
The column sinks into the floor: the party can walk over it.
static void Event_RevealSwitches(void)
Reveal: both switches show and can be searched.
u32 gGuardRoomDoorCells[]
static void LunpaFortress_OpenCoveredPassage(void)
The passage behind the second Whirlwind cover opens.
static s32 LunpaFortress_IsLeaderInOuterPatrolSafeZone(void)
Where the outer rooms' patrol cannot see the leader: three stretches of its rounds.
static void Event_FlipSecondSwitch(void)
Searching the second switch while Reveal shows it flips it, and its passage opens.
u32 gLunpaFortressExitsOther[]
Scenes 161 to 163 are the fortress's maps 2 to 4; field_scene.h has no names for them yet,...
struct SceneEntrance gLunpaFortressEntrances2[]
static void LunpaFortress_RestoreRescueRoomDoors(void)
The rescue room's cell doors stay open.
static void UNUSED LunpaFortress_DoNothingB(void)
u32 gRescueRoomDoorCells[]
static void Event_UpperHallGuardThrowsPartyOut(void)
Raised when the upper hall's guard spots the leader: he throws the party out.
static void LunpaFortress_UpdateOuterGuardDetection(void)
Every frame in the outer rooms: the patrolling guard, as LunpaFortress_UpdatePairedGuardDetection; se...
static void Event_FightThreeGuards(void)
Walking up to the three guards: they argue, then fight the party together.
static void Event_FightEastGuard(void)
Walking up to the east guard: he challenges the party to a battle, and is gone after it.
struct SceneEvent gLunpaFortressEvents3[]
#define PATROL_PSYNERGY_REQUEST(work)
static void LunpaFortress_RestoreColumnRoomDoors(void)
The column room's cell doors stay open.
static void Event_HallPatrolThrowsPartyOut(void)
Raised when the hall patrol spots the leader: it throws the party out.
struct SceneEntrance gLunpaFortressEntrances3[]
static void LunpaFortress_InitializeGuardRooms(void)
Sets the guard rooms up: beaten guards gone or lying where they fell, the Cell Key gone once taken,...
static void LunpaFortress_RestoreLoweredColumn(void)
The column stays sunk in its hole.
struct SceneEntrance gLunpaFortressEntrancesOther[]
static s32 LunpaFortress_CanGuardSeeLeader(s32 actorId)
Whether a guard on screen sees the leader along his row or column.
struct SceneEntrance gLunpaFortressEntrances1[]
static void UNUSED LunpaFortress_TryCollectActorNineItem(void)
static s32 LunpaFortress_IsLeaderInGuardVerticalSight(s32 actorId)
Whether the leader is in the guard's column, up to six cells away.
static void Event_UnlockRescueRoomDoor(void)
Facing a rescue room cell door with the Cell Key: it opens with a rumble.
static void Event_ReadStartledResidentsThoughts(void)
Mind Read on the startled resident: once they have promised, a thought about Hammet; before,...
static void Event_TalkToJailedDodonpa(void)
Dodonpa behind bars begs his father's forgiveness; with the Cell Key, a further line shows.
static void Event_HideSwitches(void)
Reveal's end: both switches hide again.
static void LunpaFortress_RestoreOuterDoors(void)
The outer rooms' cell doors stay open.
static void Event_BlowAwaySecondSwitchCover(void)
Whirlwind on what hides the second switch: it blows away.
static void LunpaFortress_OpenColumnRoomDoor(s32 doorIndex)
Draws a column room cell door open and lets the party through; the middle door opens two cells.
static void LunpaFortress_CheckGuardDoorApproach(void)
Every frame in the guard rooms: walking east or west into the first cell door's column with the Cell ...
static void LunpaFortress_ActOutScoundrelDialogue(s32 actorId)
A guard calls the party a scoundrel. "You scoundrel!".
static void Event_ReadDonpasThoughts(void)
Mind Read on Donpa.
static void LunpaFortress_UpdateHallGuardDetection(void)
Every frame in the guard rooms: the patrol in the east hall, as LunpaFortress_UpdatePairedGuardDetect...
@ OUTER_STARTLED_RESIDENT
static s32 LunpaFortress_IsLeaderOutsideUpperHall(void)
Whether the leader is outside the upper hall the guard there watches.
static void LunpaFortress_GuardChallengesParty(s32 actorId)
A guard faces the leader with one of four challenges, chosen at random when the map was entered.
static void UNUSED LunpaFortress_DoNothingE(void)
static void LunpaFortress_PositionPartyForMonster(void)
The party spreads out and faces the monster.
static void LunpaFortress_InitializeColumnRoom(void)
Sets the column room up: the doors, the column, the Whirlwind covers and the switches as the party le...
static void LunpaFortress_GatherPartyAroundHammet(void)
Garet, Ivan and Mia step out of the leader and gather around Hammet.
struct SceneEvent gLunpaFortressEventsOther[]
static void Event_OuterPatrolThrowsPartyOut(void)
Raised when the outer rooms' patrol spots the leader: it throws the party out.
static void LunpaFortress_CheckFirstEntranceSentry(void)
Every frame past the entrance: either sentry who sees the uncloaked leader raises TRIGGER_SENTRIES_SP...
static s32 LunpaFortress_IsLeaderInGuardHorizontalSight(s32 actorId)
Whether the leader is within a row of the guard, up to six cells away.
struct ScenePlacement gLunpaFortressPlacements4[]
static void UNUSED LunpaFortress_TryCollectActorElevenItem(void)
static void Event_BlowAwayPassageCover(void)
Whirlwind on what hides the passage: it blows away and the passage opens.
static void UNUSED LunpaFortress_TryCollectActorTenItem(void)
#define PAIRED_PATROL_LAYER_ORIGIN_X
The paired patrol's layer origin across: 136 pixels, in 16.16 fixed point.
static void UNUSED LunpaFortress_TryCollectActorEightItem(void)
Unused: four items set out on actors 8 to 11, each taken once, with flags 0xf2a to 0xf2d.
static s32 LunpaFortress_IsGuardNearViewCenter(s32 actorId)
Whether the guard is on screen: within seven columns and five rows of the view's center.
static void Event_TalkToDonpa(void)
Donpa: asleep before the rescue.
static void Event_FightHallGuard(void)
Walking up to the hall guard: he challenges the party to a battle, and is gone after it.
@ RESCUE_ENTRANCE_AFTER_BATTLE
@ GUARD_ROOM_ENTRANCE_AFTER_BATTLE
u32 gLunpaFortressExits3And4[]
static void Event_FindHammet(void)
Walking into Hammet's cell.
static void Event_SentriesThrowPartyOut(void)
Walking between the sentries, or seen by them: the party is sent back to the gate below the fortress.
static void Event_TalkToStartledResident(void)
A resident of the outer rooms, startled the first time, asks whether the party sneaked in in search o...
static void LunpaFortress_CheckOuterDoorApproach(void)
Every frame in the outer rooms: walking into the second cell door's column with the Cell Key unlocks ...
static void LunpaFortress_OpenSecondSwitchPassage(void)
The second switch's passage opens.
static void Event_BlowAwayFirstSwitchCover(void)
Whirlwind on what hides the first switch: it blows away.
static void LunpaFortress_ActivateLeverTrap(void)
Dodonpa's lever: the room shakes, the floor opens and everyone startles.
static void Event_UnlockOuterDoor(void)
Facing an outer room cell door with the Cell Key: it opens with a rumble.
static void LunpaFortress_PlaceThreeBeatenGuards(void)
The three guards lie beaten where they fought.
static void LunpaFortress_ActOutWhosThereDialogue(s32 actorId)
A guard asks who is there. "Huh? Who's that?".
static void LunpaFortress_GuardThrowsPartyOut(s32 actorId)
A guard who caught the party sends it back to the gate below the fortress.
static void Event_TalkToSentry(void)
The second sentry looks around, hearing someone he cannot see.
static void Event_PatrolPairThrowsPartyOut(void)
Raised when the patrolling pair spots the leader: the first stops and stares, and the second throws t...
static void Event_DjinniJoins(void)
Talking to the Djinni in Donpa's room: it joins the party.
static void LunpaFortress_RevealMonster(void)
The camera finds the monster Dodonpa has freed; it lumbers forward.
static void Event_TalkToAttendant(void)
Donpa's attendant.
#define PATROL_ITEM_REQUEST(work)
static void LunpaFortress_OpenRescueRoomDoor(s32 doorIndex)
Draws a rescue room cell door open.
struct ScenePlacement gLunpaFortressPlacements2[]
static void Event_TalkToBeatenGuardC(void)
The third of the beaten guards begs. "Owww! Hey! Don't hurt me again...".
struct ScenePlacement gLunpaFortressPlacementsOther[]
static void LunpaFortress_OpenOuterDoor(s32 doorIndex)
Draws an outer room cell door open and lets the party through.
@ COLUMN_ROOM_SECOND_SWITCH_COVER
@ COLUMN_ROOM_FIRST_SWITCH_COVER
@ COLUMN_ROOM_PASSAGE_COVER
struct SceneEvent gLunpaFortressEvents2[]
static void Event_AskWhereDodonpaIs(void)
Asks where Dodonpa is. "Do you know where Dodonpa is?".
static void UNUSED LunpaFortress_DoNothingC(void)
static void LunpaFortress_OpenGuardRoomDoor(s32 doorIndex)
Draws a guard room cell door open.
static void Event_ReadSentrysThoughts(void)
Mind Read on the second sentry: one of eight thoughts, chosen at random when the map was entered; in ...
static void Event_TakeCellKey(void)
Catch on the Cell Key hanging in the guard rooms, or talking to it: the leader steps up and takes it.
static void Event_SearchSealedDoor(void)
Searching the door no key opens.
static void UNUSED LunpaFortress_FirstPatrolThrowsPartyOut(void)
Unused: the first patrol asks who the party is and sends them out.
static void Event_SearchLockedDoor(void)
Searching a cell door without the Cell Key: it stays shut.
static void Event_ReadJailedDodonpasThoughts(void)
Mind Read on the jailed Dodonpa.
static void LunpaFortress_CheckSecondEntranceSentry(void)
The second sentry, as the first.
static void Event_EntranceGuardThrowsPartyOut(void)
Walking past the entrance guard, or seen by him: the party is sent back to the gate below the fortres...
struct ScenePlacement gLunpaFortressPlacementsWestLunpaCave[]
static void UNUSED LunpaFortress_DoNothingD(void)
static void LunpaFortress_UpdatePairedGuardDetection(void)
Every frame in the guard rooms: the pair patrolling the west corridor.
static void Event_DonpaJudgesDodonpa(void)
After the battle: the monster has fallen on Dodonpa.
static void Event_MoveColumn(void)
Move on the column: once it is past row 22, over its hole, the room shakes and it sinks.
static s32 LunpaFortress_IsLeaderInPatrolSafeZone(void)
Where the patrolling pair cannot see the leader: the west end of their corridor and the cells below i...
static void Event_ColumnSinks(void)
The column, pushed onto its hole, slides in and sinks.
static s32 LunpaFortress_IsLeaderNearGuard(s32 actorId)
Whether the leader is within four cells, walking, of the cell below the guard.
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#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.
#define ACTOR_ACTION_IDLE
Scene numbers, named after their places.
char SceneId_WestLunpaCave
char SceneId_LunpaFortress3
char SceneId_LunpaFortress2
char SceneId_LunpaFortress1
char SceneId_LunpaFortress4
Song and sound effect ids, indices into gSound_SongTable.
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_ActorShowEmote()
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s16 raisedTrigger
a raised event for Scene_RunRaisedEvent
s32 startTransition
SCENE_TRANSITION(style, variant).
s16 touchedTrigger
the step event a touch or exit event answers
s16 psynergyRequest
a field Psynergy to use, as owner << 10 | Psynergy
A field actor: a person or thing on the field with a position, motion toward a target,...
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
u8 paused
nonzero skips its script and motion, not its update
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
union FieldCoordinate z
16.16 fixed-point pixels
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
Full event work allocated by Field_RunScene (heap slot 27).
s16 cloaked
1 under Cloak, which prevents battles
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 system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
Values that differ by patch level or language, chosen once for their code.
#define LUNPA_RETURN_TRANSITION_VARIANT
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels