Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/symbols.extern.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ SetSprt = 0x8004D6E4;
SetTile = 0x8004D704;
SetDrawTPage = 0x8004D724;
SetDrawMove = 0x8004D754;
deactivateBattleCmd = 0x800308B0;
SetDrawLoad = 0x8004D7B4;
g_gameState = 0x80077378;
g_characterMagic = 0x80077818;
Expand Down
2 changes: 1 addition & 1 deletion include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "psxsdk/libgpu.h"
#include "psxsdk/libgte.h"
#include "tim.h"
#include "battle_anim.h" /* AnimFrame, BattleAnimEntity, BattleAnimState, g_battleAnims */
#include "battle_anim.h"

/** @brief Battle result values (BattleConfig.result). */
#define BATTLE_RESULT_UNDETERMINED 0
Expand Down
2 changes: 0 additions & 2 deletions include/field/fe_object1.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ extern CdFileDesc D_800C0910[]; /**< Streaming table, third descriptor (passed

/** @brief Field id currently being streamed in (compared against @c D_8005F100). */
extern s16 D_8005F14E;
/** @brief Field render/present state halfword; the loader spins while it reads 4. */
extern volatile s16 D_8005F146;

/** @brief Section-pointer table bases published by the loaded field bundle. */
extern u8 **D_800C7208; /**< Event-queue block; assigned to @c D_8005F0F8. */
Expand Down
7 changes: 5 additions & 2 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define MAIN_H

#include "common.h"
#include "cd.h" /* CdFileDesc */
#include "psxsdk/libgpu.h" /* TILE */
#include "cd.h"
#include "psxsdk/libgpu.h"

/* =============================================================== *
* Public interface — functions in main.c called by other units. *
Expand Down Expand Up @@ -53,6 +53,9 @@ extern u8 g_vsyncSkip;
extern volatile s32 D_8005F154; /**< VSync frame-counter timing accumulator (+0x88F/VSync). */
extern volatile s32 D_8005F15C; /**< VSync countdown-timer timing accumulator (+0x88F/VSync). */
extern u16 D_8005F11E; /**< VSync-done / status flag. */
/** Scene-transition handshake driven by the VSync path; shared by the field,
* world and battle engines (each spins on it with its own sentinel value). */
extern volatile s16 D_8005F146;

/* CD file-table descriptors + scratch buffers loaded/managed by main.c. */
extern CdFileDesc g_fileTableDesc[];
Expand Down
4 changes: 2 additions & 2 deletions include/menuitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define MENUITEM_H

#include "common.h"
#include "gamestate.h" /* g_gameState */
#include "menumain.h" /* D_801F889C and the rest of the resident menu image */
#include "gamestate.h"
#include "menumain.h"

extern s32 D_80083850;
extern s32 D_801ECC10;
Expand Down
5 changes: 1 addition & 4 deletions include/overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define OVERLAY_H

#include "common.h"
#include "world/we_object0.h"

/**
* @brief Overlay command queue entry (D_80085168, 8-slot ring buffer).
Expand Down Expand Up @@ -57,8 +58,4 @@ extern s32 func_8003646C(); /* K&R: called with 1 or 2 args */
/** @brief Run the loaded overlay's entry point (init / execute). */
extern void func_80098000(void);

/** @brief Query the loaded overlay; returns a status code (main checks @c == 1).
* @note Purpose uncertain - undecompiled; appears to report the overlay's
* load/ready result. */
extern s32 func_800987D8(void);
#endif /* OVERLAY_H */
2 changes: 1 addition & 1 deletion include/tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define TIM_H

#include "common.h"
#include "psxsdk/libgpu.h" /* RECT */
#include "psxsdk/libgpu.h"

/**
* @brief One section of a PS1 TIM image file (CLUT block or pixel block).
Expand Down
6 changes: 3 additions & 3 deletions include/tripletriad.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define TRIPLETRIAD_H

#include "common.h"
#include "psxsdk/libgpu.h" /* TSPRT (drawCardOverlaySprite) */
#include "psxsdk/libgte.h" /* SVECTOR / MATRIX (CardRenderWork, CardAnimNode) */
#include "main.h" /* g_activeDrawEnv */
#include "psxsdk/libgpu.h"
#include "psxsdk/libgte.h"
#include "main.h"

/* Types, constants, and globals for the Triple Triad card mini-game. Its code
is the `tripletriad` overlay, which loads at the same VRAM address
Expand Down
2 changes: 1 addition & 1 deletion include/tripletriad/be_object1.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "common.h"
#include "tripletriad.h"
#include "tim.h" /* Tim / TimSection (queued VRAM image uploads) */
#include "tim.h"

/* Declarations for be_object1.c (Triple Triad board/card setup, draw-buffer
init, deferred VRAM transfers, the object-list system, debug text, and the
Expand Down
2 changes: 1 addition & 1 deletion include/tripletriad/be_object1b.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define TRIPLETRIAD_BE_OBJECT1B_H

#include "common.h"
#include "psxsdk/libgte.h" /* SVECTOR (layoutCardSlot) */
#include "psxsdk/libgte.h"

/* Declarations for be_object1b.c (Triple Triad match-flow controller, the
per-frame update-list callbacks, and card-object search helpers). */
Expand Down
2 changes: 1 addition & 1 deletion include/tripletriad/be_object2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define TRIPLETRIAD_BE_OBJECT2_H

#include "common.h"
#include "tripletriad.h" /* board/card types, SVECTOR / CVECTOR / VECTOR */
#include "tripletriad.h"

/* Declarations for be_object2.c (Triple Triad card objects, the rules engine,
the menu/cursor sub-machine, and the AI move search). */
Expand Down
2 changes: 1 addition & 1 deletion include/tripletriad/be_object4.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "common.h"
#include "tripletriad.h"
#include "battle_anim.h" /* BattleAnimState / BattleAnimEntity (func_800A29D4 prototype) */
#include "battle_anim.h"

/* Public interface of be_object4.c: the Triple Triad SFX request queue, the card-detail
popup buffers, the rule-description string table, and the message-gate / menu helpers
Expand Down
23 changes: 11 additions & 12 deletions include/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "psxsdk/libgpu.h"
#include "psxsdk/libgte.h"
#include "battle.h"
#include "gamestate.h"
#include "sound.h"

/** View of the sentinel ctx exposing the DISPENV template that sits past the
Expand Down Expand Up @@ -204,14 +205,8 @@ extern s32 D_800DCB48;
* @brief 8-byte world-transform block — four packed halfwords.
*
* Every field is read/written as @c lh / @c sh at a fixed offset. Only
* @c angle has an identified role (input to rotation helper @c getAngleDelta).
*/
typedef struct {
/* 0x00 */ s16 unk0;
/* 0x02 */ s16 angle;
/* 0x04 */ s16 unk4;
/* 0x06 */ s16 unk6;
} WorldXformBlock; /* 0x08 */


/**
* @brief 16-byte world-transform record at @c D_800D2390 (pair of blocks).
Expand All @@ -220,8 +215,8 @@ typedef struct {
* snapshots @c tail, adjusts its @c angle, and forwards the modified copy.
*/
typedef struct {
/* 0x00 */ WorldXformBlock head;
/* 0x08 */ WorldXformBlock tail;
/* 0x00 */ SVECTOR head;
/* 0x08 */ SVECTOR tail;
} WorldXform; /* 0x10 */

/* Shared world-overlay state referenced by more than one we_object*.c.
Expand Down Expand Up @@ -261,7 +256,8 @@ extern s32 D_800C97F4; /**< World camera angle. Stored as a wo
angular-delta helpers in we_object9 read only its
low half — hence the (u16) cast at those sites. */
extern MATRIX D_800C9838; /**< World-to-screen matrix loaded into the GTE. */
extern WorldPos D_800C9868; /**< Source camera world position (cast to VECTOR* for GTE transform func_800BC544). */
extern VECTOR D_800C9868; /**< Source camera world position. 16 bytes: the world entry loop copies
it whole into @c D_800C9858 and hands it straight to func_800BC544. */
extern SVECTOR D_800C9770[2]; /**< Camera scratch: [0] is a position offset, [1] a rotation. */
extern s32 *D_800C9744; /**< Texture-strip animation block: a NULL-terminated s32 offset
table; each offset, relative to this pointer, locates one
Expand Down Expand Up @@ -527,7 +523,11 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 pad00[0x18];
/* 0x18 */ Track tracks[2]; /**< Track A at 0x18, Track B at 0x24. */
/* 0x30 */ u8 pad30[0x3C];
/* 0x30 */ u8 pad30[0x38];
/* 0x68 */ SceneState scene; /**< Saved scene state; the world entry loop
saves the whole record here on a cold
start and restores @c cmd from it on a
warm one. */
/* 0x6C */ s32 unk6C; /**< Flags word; see SLOT_FLAG_CMD_MIRROR. */
/* 0x70 */ u8 pad70[0x4];
/* 0x74 */ u32 flags[2]; /**< 64-bit flag set (low/high). */
Expand Down Expand Up @@ -565,7 +565,6 @@ typedef struct {

extern BattleSceneCtx D_800CA040; /**< Worldmap "no-battle" sentinel — also functions as an empty BattleSceneCtx. */
extern s16 D_800C53B8[]; /**< Bone-id table (used by we_object4). */
extern ScriptOp *func_800AF004(u8 *base, s32 flag);
extern s32 func_800AF28C(ScriptOp *p);
extern s32 func_800BEFC4(void);
extern void func_800BD82C(u8 *actor, SlotEntry *slot, s32 marker, s32 flag, SVECTOR *rot, VECTOR *trans);
Expand Down
9 changes: 9 additions & 0 deletions include/world/we_object0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef WORLD_WE_OBJECT0_H
#define WORLD_WE_OBJECT0_H

#include "common.h"
#include "overlay.h"

extern s32 func_800987D8(void);

#endif /* WORLD_WE_OBJECT0_H */
21 changes: 11 additions & 10 deletions include/world/we_object1.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "gamestate.h"
#include "psxsdk/libgpu.h"
#include "psxsdk/libgte.h"
#include "main.h" /* g_activeDrawEnv */
#include "main.h"

/* Projection scratch: worldPosToCell writes @c proj and returns @c angle. The
trailing @c pad keeps the buffer 0x20 bytes (gcc reserves the full slot).
Expand Down Expand Up @@ -104,8 +104,6 @@ extern POLY_FT4 D_800C8648[2]; /* double-buffered worldmap quad primitive */
extern void func_8009C528(s32 rc);
extern void func_8009FEDC(u8 *work, u8 type);
extern s32 func_80042634(s32 a);
extern void func_800A5F78(s32 screen);
extern void func_800A5FD4(s32 screen);
extern void func_800A5D10(void);
extern s32 getCurrentFieldMusic(void); /* defined u16 in btl_sfx; used full-width here */
extern void setSfxPitch(s32 idx, s32 val);
Expand All @@ -125,17 +123,10 @@ extern void func_80039678(s32 a, s32 b, s32 c);
extern void func_8009CDC4(s32 a, s32 b);
extern void func_8009CE40(void);
extern s32 func_8009D7D8(s32 a);
extern s32 func_800ACD38(MATRIX *out);
extern void func_8003FD84(MATRIX *xform, VECTOR *in, VECTOR *out);
extern void func_800BC544(VECTOR *src, VECTOR *dst);
extern void func_8009C478(s32 *src, s32 x, s32 y);
extern CmdDesc *glyphAt(GlyphQuery *v, AngleSlot *out);
extern s32 func_800BEC1C(s32 kind);
extern void func_8009D630(void);
extern void func_800B3FD4(Slot *slot, s32 arg);
extern void fadeOutSfxFast(s32 idx);
extern void renderAndUpdateDisplay(s32 frames);
extern s32 renderBattleDisplayList(s32 *colorTag);
extern void sndSeqSetTempoAlt(s32 tempo);
extern void sndSetMasterVolume(s32 vol);
extern void sndCmdF1(void);
Expand All @@ -144,4 +135,14 @@ extern void sndSeqStartPan(s32 a0, s32 a1, s32 a2, s32 a3);
extern void sndSeqPlayPan7bit(s32 a0, s32 a1, s32 a2, s32 a3);
extern void func_8004D604(POLY_FT4 *prim, s32 frame);

extern s32 func_800997E8(u16 *out);
extern void func_80099F78(void);
extern void func_8009A954(void);
extern void func_8009AEE4(s32 id);
extern void func_8009B954(s32 a, s32 b, s32 c);

extern s32 func_8009B358(s32 slotIdx, s32 strIdx, u8 *text);

extern s32 func_8009CC3C(void);

#endif /* WORLD_WE_OBJECT1_H */
17 changes: 6 additions & 11 deletions include/world/we_object10.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "common.h"
#include "world.h"
#include "world/we_object3.h"
#include "psxsdk/libgte.h"

/** @brief 32-byte record used by func_800BE5F8's table walker. */
Expand Down Expand Up @@ -57,20 +58,14 @@ extern u8 *D_800C9E34;

extern void func_800BAC84(u8 *p);
extern s32 func_800BA870(u8 *p);
extern s32 func_800B0010(void);
extern void func_800AC0A0(s32 marker, VECTOR *position, SVECTOR *vec, s32 zero);
extern void *func_80047CE4(void *dst, s32 c, u32 n);
extern s32 func_800BEF6C(void);
extern s32 func_8009CC3C(void);
extern void func_800AEB58(XformEntry *entry, XformGroup *group);
extern void func_8009C5FC(s32 *data);
extern void func_800BC51C(VECTOR *src, VECTOR *dst);
extern void func_800BC544(VECTOR *src, VECTOR *dst);
extern ScriptOp *func_800AF004(u8 *base, s32 flag);
extern s32 func_8009B358(s32 slotIdx, s32 strIdx, u8 *text);
extern void func_8009D8A8(s32 a0);
extern void fadeOutSfxFast(s32 idx);
extern void renderAndUpdateDisplay(s32 frameCount);
extern s32 renderBattleDisplayList(s32 *colorTag);

extern void func_800BEC60(u8 *flags);

extern void func_800BF20C(CmdDesc *p, s32 kind, s32 arg);
extern void func_800BF2E8(GlyphHeader *p, s32 *ot, WorldPrimBank *pools);

#endif /* WORLD_WE_OBJECT10_H */
11 changes: 11 additions & 0 deletions include/world/we_object11.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef WORLD_WE_OBJECT11_H
#define WORLD_WE_OBJECT11_H

#include "common.h"
#include "world.h"
#include "world/we_object3.h"

extern void func_800BF80C(GlyphHeader *p, s32 *ot, WorldPrimBank *pools);
extern void func_800BFBFC(s32 kind);

#endif /* WORLD_WE_OBJECT11_H */
2 changes: 2 additions & 0 deletions include/world/we_object13.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ extern s32 func_800C4480(s32 src, s32 len, u32 *buf);
/* Reset the streaming controller; returns its status word. */
extern s32 func_800C4450(void);

extern void func_800C4AE4(s32 a);

#endif /* WORLD_WE_OBJECT13_H */
15 changes: 6 additions & 9 deletions include/world/we_object2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common.h"
#include "world.h"
#include "psxsdk/libgte.h"
#include "psxsdk/libetc.h"

typedef struct {
s16 a;
Expand Down Expand Up @@ -48,17 +49,8 @@ extern u16 D_800C5346; /* per-map yaw target (func_8009F6EC b
extern s32 D_800C9730; /* GTE projection-plane distance (SetGeomScreen arg). */
extern s32 D_800D2448; /* world-ready gate flag (func_8009F6EC bit 0x10). */

/* VSync is declared here with a void-returning view for this file's
* matching codegen (psxsdk/libetc.h's s32-returning prototype is not used). */
extern void VSync(s32 mode);

extern void func_800A5F78(s32 screen);
extern void func_800A5FD4(s32 screen);
extern void func_80099EDC(s32 idx);
extern void func_800B3FD4(Slot *a0, s32 a1);
extern void func_8009D630(void);
extern void renderAndUpdateDisplay(s32 mode);
extern s32 renderBattleDisplayList(s32 *colorTag);
extern s32 func_800BD380(s16 *outLow, s16 *outHigh);
extern s32 func_800BD2A0(s16 *outLow, s16 *outHigh);
extern s32 func_800BD460(s16 *outLow, s16 *outHigh);
Expand All @@ -78,4 +70,9 @@ extern void sndDisableReverb(u32 a);
/* Defined in we_object2.c — shortest signed angular difference (0x1000 == 360°). */
extern s32 getAngleDelta(s32 a, s32 b);

extern void func_8009DB88(u8 *p);
extern void func_8009E5C8(VECTOR *pos, u8 *p, SVECTOR *ang, void *x);

extern void func_8009D8A8(s32 a0);

#endif /* WORLD_WE_OBJECT2_H */
Loading
Loading