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
15 changes: 11 additions & 4 deletions config/sym_extern.us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ g_RewardMenuTable = 0x800697EC;
g_EntityToLine = 0x8007078C;
g_BattleMode = 0x800707BE;
g_FieldScriptSyncWaitEntity = 0x80071A88;
g_PosCursorDisabled = 0x80071C1C;
g_FieldMusicLock = 0x800716D4;
g_FieldWaitCounter = 0x800716DC;
g_SavedFieldScriptPC = 0x80071748;
Expand All @@ -17,25 +18,27 @@ g_CurrentEntity = 0x800722C4;
D_800730CC = 0x800730CC;
g_MateriaData = 0x800730D0;
g_FieldMapVars = 0x80075E24;
g_FieldModelAnimStatus = 0x800756E8;
g_FieldText = 0x8007E7A8;
g_FieldLines = 0x8007E7AC;
g_EntityToModel = 0x8007EB98;
g_EntitySplitJoinState = 0x80081D90;
g_CharacterLock = 0x80081DC4;
g_FieldModelEffAnimSpeed = 0x80082248;
g_FieldScriptPC = 0x800831FC;

g_FieldModelAnimId = 0x8008325C;
g_WindowToEntity = 0x8008326C;
g_WindowData = 0x80083274;
g_FieldScriptSyncState = 0x800833F8;
g_FieldLineCount = 0x80095D84;
g_FieldPaletteBuffer = 0x80095DE0;
D_80099788 = 0x80099788;
D_8009A000 = 0x8009A000;
D_8009A004 = 0x8009A004;
D_8009A008 = 0x8009A008;
D_8009A00C = 0x8009A00C;
g_PartyMenuTables = 0x8009A0C8;
g_ActiveCharacters = 0x8009D84C;
g_CharacterLevelData = 0x8009D7E4;
g_BattleItemsEarned = 0x8009D808;
g_FieldScriptPriority = 0x8009A1C4;
g_FieldState = 0x8009ABF4;
g_CharIdToEntity = 0x8009AD30;
Expand All @@ -44,7 +47,11 @@ g_FieldModelCount = 0x8009C6C4;
g_FieldScripts = 0x8009C6DC;
g_pFieldState = 0x8009C6E0;
Savemap = 0x8009C6E4;
g_CharacterLevelData = 0x8009D7E4;
g_BattleItemsEarned = 0x8009D808;
g_DebugLevel = 0x8009D820;
g_FieldModelBaseAnimSpeed = 0x8009D828;
g_ActiveCharacters = 0x8009D84C;
func_800A0000 = 0x800A0000;
func_800A0030 = 0x800A0030;
func_800A00BC = 0x800A00BC;
Expand Down Expand Up @@ -94,10 +101,10 @@ D_800708C4 = 0x800708C4;
D_80082268 = 0x80082268;
D_80082460 = 0x80082460;
D_80082484 = 0x80082484;
D_8009D58A = 0x8009D58A;
D_8009D7D8 = 0x8009D7D8;
D_8009D7DC = 0x8009D7DC;
D_8009D7E0 = 0x8009D7E0;
D_8009D7ED = 0x8009D7ED;
D_8009D7EE = 0x8009D7EE;
D_8009D58A = 0x8009D58A;
D_80167938 = 0x80167938;
6 changes: 3 additions & 3 deletions config/sym_ovl_export.us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1512,9 +1512,9 @@ FieldEnablePartyModels = 0x800bb1b4;
FieldEventOpcodeCycle = 0x800bb3a8;
FieldUpdateAnimationState = 0x800bbbcc;
FieldEventRequestRun = 0x800bbf74;
ResetFieldRenderState = 0x800bc338;
UpdateFieldExitArrows = 0x800bc438;
DrawFieldExitArrow = 0x800bc4d4;
ResetPositionCursorPrimitives = 0x800bc338;
UpdatePositionCursor = 0x800bc438;
DrawPositionCursor = 0x800bc4d4;
DebugUpdateActor = 0x800bc9fc;
DebugPrintOpcode = 0x800bead4;
FieldDebugAddParseValueToPage2 = 0x800beca4;
Expand Down
10 changes: 7 additions & 3 deletions config/symbols.field.us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ FieldEnablePartyModels = 0x800BB1B4;
FieldEventOpcodeCycle = 0x800BB3A8;
FieldUpdateAnimationState = 0x800BBBCC;
FieldEventRequestRun = 0x800BBF74;
ResetFieldRenderState = 0x800BC338;
UpdateFieldExitArrows = 0x800BC438;
DrawFieldExitArrow = 0x800BC4D4;
ResetPositionCursorPrimitives = 0x800BC338;
UpdatePositionCursor = 0x800BC438;
DrawPositionCursor = 0x800BC4D4;
DebugUpdateActor = 0x800BC9FC;
DebugPrintOpcode = 0x800BEAD4;
FieldDebugAddParseValueToPage2 = 0x800BECA4;
Expand Down Expand Up @@ -545,6 +545,7 @@ g_DebugMessageBuffer = 0x800E4288;
g_FieldRain = 0x800E42D8; // size:0x600
g_RainForce = 0x800E48D8;
g_EntityForSplitJoin = 0x800E48F0;
g_PosCursorPrims = 0x800E48F4; // size:0x50
g_WindowString = 0x800E4944; // size:0x400
g_FieldMoviePlayed = 0x800E4D44;
g_WindowReplaceBankAddr = 0x800E4D48;
Expand All @@ -553,7 +554,10 @@ g_WindowExtraRows = 0x801142CC; // size:0x8
SavedScriptIds = 0x801142D4; // size:0x180
g_FieldKeyState = 0x80114454; //size:0x4
g_WindowWaitTime = 0x8011445C;
g_PosCursorX = 0x80114464;
g_PosCursorY = 0x80114468;
g_WindowTextBudget = 0x80114470; // size:0x8
g_WindowFastForwardLevel = 0x80114480; // size:0x8
g_PosCursorPrimId = 0x80114490;
g_WindowBuffer = 0x801144DC; // size:0x40
g_WindowBufferPos = 0x8011451C; // size:0x8
53 changes: 35 additions & 18 deletions include/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ typedef enum {
WSTATE_WAIT_NEXT_WINDOW,
} WindowState;

typedef enum {
ANIMSTATUS_DEFAULT_LOOP, // Loop and track animId/effAnimSpeed.
ANIMSTATUS_SCRIPTED_LOOP, // Loop current requested animation without
// re-tracking defaults.
ANIMSTATUS_PLAY_ONCE_SYNC, // Blocking one-shot.
ANIMSTATUS_HOLD_FRAME, // Freeze on last frame.
ANIMSTATUS_PLAY_ONCE_SYNC_DONE, // Blocking one-shot finished, waiting for
// script-side consumption.
ANIMSTATUS_PLAY_ONCE_THEN_RESET, // Non-blocking one-shot, return to
// DEFAULT_LOOP when done.
ANIMSTATUS_PLAY_ONCE_THEN_HOLD, // Non-blocking one-shot, go to HOLD_FRAME
// when done.
} ModelAnimationStatus;

typedef struct {
s16 x1;
s16 y1;
Expand Down Expand Up @@ -840,14 +854,14 @@ typedef struct {
u8 unk67;
// Uses PADx macros in libetc.h
// Raw states ignore custom key mapping set by player.
u32 activeKeysRaw; // Currently active keys.
u32 activeKeysPrevRaw; // activeKeysRaw from last frame.
u32 pressedKeysRaw; // Was inactive last frame.
u32 releasedKeysRaw; // Was active last frame.
u32 activeKeys;
u32 activeKeysPrev;
u32 pressedKeys;
u32 releasedKeys;
s32 activeKeysRaw; // Currently active keys.
s32 activeKeysPrevRaw; // activeKeysRaw from last frame.
s32 pressedKeysRaw; // Was inactive last frame.
s32 releasedKeysRaw; // Was active last frame.
s32 activeKeys;
s32 activeKeysPrev;
s32 pressedKeys;
s32 releasedKeys;
s16 currentMovieFrame;
// Set by SHAKE to enable a randomized camera shake effect.
FieldShakeData shakeX;
Expand Down Expand Up @@ -975,7 +989,7 @@ extern u8 D_800708D0[][0x1C]; // kernel-region table, by attack/effect id
extern AttackData D_800722CC[]; // magic/summon/skill table
extern WeaponRecord g_WeaponTable[]; // 0x800738A0, by weapon id
extern FieldEntity g_FieldEntity[];
extern u8 D_800756E8[]; // per-model flags, indexed by field model id
extern u8 g_FieldModelAnimStatus[16]; // per-model flags, indexed by field model id
extern s32 D_800756F8[];
extern Unk80075D00* D_80075D00;
extern int D_80075DEC; // buffer index, either 0 or 1
Expand All @@ -988,22 +1002,25 @@ extern DISPENV D_8007EB68[2];
extern u8 g_EntityToModel[48]; // entity id -> model id (0xFF: none)
extern s8 D_8007EBCC;
extern s8 D_8007EBDC;
extern u8 D_8007EBE0; // field debug mode
extern u8 g_CharacterLock; // mirror of the UC opcode's control-lock flag
extern u8 g_EntitySplitJoinState[48]; // states for SPLIT and JOIN opcodes
extern s16 D_80082248[]; // per-model current animation playback speed
extern u8 D_8007EBE0; // field debug mode
extern u8 g_CharacterLock; // mirror of the UC opcode's control-lock flag
extern u8 g_EntitySplitJoinState[48]; // states for SPLIT and JOIN opcodes
extern s16 g_FieldModelEffAnimSpeed[16]; // per-model current animation playback speed
extern u8 D_80083184[0x40];
extern u8 D_800831C4[]; // Magic Order table from kernel.bin section 3.
extern u16 g_FieldScriptPC[48]; // program counters for active entity scripts
extern u8 D_8008325C[]; // per-model default animation id (DFANM)
extern u8 D_800831C4[]; // Magic Order table from kernel.bin section 3.
extern u16 g_FieldScriptPC[48]; // program counters for active entity scripts
extern u8 g_FieldModelAnimId[16]; // per-model default animation id (DFANM)
extern u8 g_WindowToEntity[4];
extern WindowData g_WindowData[4];
extern u8 D_8008325C[16];
extern u8 D_8008326C[4];
extern s32 D_80083338;

extern u8 g_FieldScriptSyncState[48][8]; // sync states of entity scripts per
// priority level
extern FieldModelLoaderData* g_FieldModelLoaderData;
extern s16 g_FieldLineCount;
extern u16 g_FieldPaletteBuffer[64][16];
extern s8 D_80095DCC;
extern volatile u16 D_80095DD4;
extern s16 g_PlayerModelId;
Expand Down Expand Up @@ -1041,8 +1058,8 @@ extern u8 D_8009D60E;
extern u8 g_DebugLevel; // field debug related
extern CharacterLevelData g_CharacterLevelData[3];
extern u8 D_8009D824;
extern s16 D_8009D828[]; // per-model base animation speed
extern s16 D_8009D85C[]; // record fields, stride 0x440
extern s16 g_FieldModelBaseAnimSpeed[16]; // per-model base animation speed
extern s16 D_8009D85C[]; // record fields, stride 0x440
extern BattleItemReward g_BattleItemsEarned[4];
extern u8 D_8009D8F8[];
extern u32 D_8009D260;
Expand Down
7 changes: 5 additions & 2 deletions include/psxsdk/libgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ extern int (*GPU_printf)(); /* printf() object */
((tge) ? setcode(p, getcode(p) | 0x01) : setcode(p, getcode(p) & ~0x01))

#define getTPage(tp, abr, x, y) \

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced the getTPage definition from Psy-Q 4.x with the definition from 3.3-3.6 as ResetPositionCursorPrimitives requires it to match. Didn't find any conflicting usages of it.

((((tp) & 0x3) << 7) | (((abr) & 0x3) << 5) | (((y) & 0x100) >> 4) | \
(((x) & 0x3ff) >> 6) | (((y) & 0x200) << 2))
((GetGraphType()==1||GetGraphType()==2)? \
((((tp)&0x3)<<9)|(((abr)&0x3)<<7)|(((y)&0x300)>>3)|(((x)&0x3ff)>>6)): \
((((tp)&0x3)<<7)|(((abr)&0x3)<<5)|(((y)&0x100)>>4)|(((x)&0x3ff)>>6)| \
(((y)&0x200)<<2)))

#define getClut(x, y) ((y << 6) | ((x >> 4) & 0x3f))

Expand Down Expand Up @@ -644,4 +646,5 @@ extern DISPENV* SetDefDispEnv(DISPENV* env, int x, int y, int w, int h);
extern DRAWENV* SetDefDrawEnv(DRAWENV* env, int x, int y, int w, int h);
extern TIM_IMAGE* ReadTIM(TIM_IMAGE* timimg);

extern int GetGraphType(void);

@Zaarbs Zaarbs Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://psx.arthus.net/sdk/Psy-Q/DOCS/BBS/webmsg.pdf - Page 31 says to add the declaration like this since it wasn't included in LIBGPU.H by default.

#endif
2 changes: 0 additions & 2 deletions src/field/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ extern s32 (*g_FieldOpcodes[256])(void);
extern u8 g_EntityForSplitJoin;
extern s16 D_800DF120[][2];
extern char g_DebugMessageBuffer[]; // debug value transformed into text

extern u8 D_80114498[];
extern u32 g_FieldKeyState;

void AddBackgroundToRender(struct FieldRenderData* buf);
Expand Down
10 changes: 5 additions & 5 deletions src/field/field2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <libetc.h>

extern u8 D_800E08C0[];
extern char D_800E0628[];
extern char D_800E0630[];
extern u8 g_DialogDigitCharacters[16];
extern u8 g_WindowReplaceBank[4][8];
extern u16 g_WindowReplaceBankAddr[4][8];
Expand All @@ -19,8 +21,6 @@ extern s16 g_WindowBufferPos[4];
extern u8 g_WindowBuffer[4][16];
extern s16 g_WindowTotalRowsHeight[4];
extern char g_FieldDebugDigits[16];
extern s8 D_800E0628;
extern s8 D_800E0630;
extern u16 g_FieldDebugRb;
extern s16 g_FieldDebugRChars;
extern s16 g_FieldDebugRLines;
Expand Down Expand Up @@ -1212,13 +1212,13 @@ void InitFieldDebugPages(void) {
SetStrToDebugRow(5, 6, " Info OFF");
FieldDebugPageHide(5);
FieldDebugPageInit(4, 0x6C, 0x52, 0x6C, 0x52);
AddStrNextDebugRow(4, &D_800E0628);
AddStrNextDebugRow(4, D_800E0628);
FieldDebugPageHide(4);
FieldDebugPageInit(3, 0x6C, 0xA4, 0x6C, 0x5C);
AddStrNextDebugRow(3, &D_800E0630);
AddStrNextDebugRow(3, D_800E0630);
FieldDebugPageHide(3);
FieldDebugPageInit(1, 0, 0, 0x6C, 0xCA);
AddStrNextDebugRow(1, &D_800E0628);
AddStrNextDebugRow(1, D_800E0628);
FieldDebugPageHide(1);
D_80099FFC = 3;
D_8007EBCC = 4;
Expand Down
Loading