rename types (#20)

This commit is contained in:
Alex Bates 2020-08-16 04:19:00 +01:00
parent 934bd5a415
commit e40b05d9c5
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
17 changed files with 512 additions and 519 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,11 @@ void osCleanupThread(void);
void clone_model(u16 srcModelID, u16 newModelID);
void update_collider_transform(s16 colliderID);
s32 get_variable(script_context* script, bytecode var);
s32 set_variable(script_context* script, bytecode var, s32 value);
f32 get_float_variable(script_context* script, bytecode var);
f32 set_float_variable(script_context* script, bytecode var, f32 value);
void set_script_timescale(script_context* script, f32 timescale);
s32 get_variable(Script* script, bytecode var);
s32 set_variable(Script* script, bytecode var, s32 value);
f32 get_float_variable(Script* script, bytecode var);
f32 set_float_variable(Script* script, bytecode var, f32 value);
void set_script_timescale(Script* script, f32 timescale);
f32 sin_deg(f32 x);
f32 cos_deg(f32 x);
f32 atan2(f32 startX, f32 startZ, f32 endX, f32 endZ);
@ -32,9 +32,9 @@ void sort_items(void);
s32 is_ability_active(s32 arg0);
f32 update_lerp(EASING easing, f32 start, f32 end, s32 elapsed, s32 duration);
npc* get_npc_safe(s32 npcID);
npc* get_npc_unsafe(s32 npcID);
npc* resolve_npc(script_context* script, NPC npcID);
Npc* get_npc_safe(s32 npcID);
Npc* get_npc_unsafe(s32 npcID);
Npc* resolve_npc(Script* script, NPC npcID);
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by);
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz);

View File

@ -5,15 +5,15 @@
#include "common_structs.h"
#include "types.h"
extern ui_status gUIStatus;
extern player_data gPlayerData;
extern player_status gPlayerStatus;
extern game_status* gGameStatusPtr[1];
extern item_table_entry gItemTable[364];
extern UiStatus gUIStatus;
extern PlayerData gPlayerData;
extern PlayerStatus gPlayerStatus;
extern GameStatus* gGameStatusPtr[1];
extern Item gItemTable[364];
extern script_context* gWorldScriptList[128];
extern script_context* gBattleScriptList[128];
extern script_context** gCurrentScriptListPtr[128];
extern Script* gWorldScriptList[128];
extern Script* gBattleScriptList[128];
extern Script** gCurrentScriptListPtr[128];
extern f32 gGlobalTimeSpace;
@ -24,17 +24,17 @@ extern s16 D_8010CD12;
extern s32 D_801595A0;
extern char gCloudyFlowerFieldsBg[]; // "fla_bg"
extern char gSunnyFlowerFieldsBg[]; // "flb_bg"
extern bg_header gBackgroundImage;
extern BackgroundHeader gBackgroundImage;
extern s8 D_8014F12F;
extern print_context* gCurrentPrintContext;
extern print_context* D_802DB268;
extern PrintContext* gCurrentPrintContext;
extern PrintContext* D_802DB268;
// Triggers
/* 0x80151334 */ extern s16 gTriggerCount;
/* 0x80159190 */ extern trigger gTriggerList1[64];
/* 0x80159290 */ extern trigger gTriggerList2[64];
/* 0x80159390 */ extern trigger** gCurrentTriggerListPtr[64];
/* 0x80159190 */ extern Trigger gTriggerList1[64];
/* 0x80159290 */ extern Trigger gTriggerList2[64];
/* 0x80159390 */ extern Trigger** gCurrentTriggerListPtr[64];
extern u16 gMapTransitionAlpha;
extern u16 D_800A0942;

View File

@ -14,7 +14,7 @@ INCLUDE_ASM(code_111f0_len_860, func_80035E54);
INCLUDE_ASM(code_111f0_len_860, func_80035EEC);
void func_800360FC(void) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->loadMenuState == 2) {
func_800E973C();
@ -22,7 +22,7 @@ void func_800360FC(void) {
}
void func_80036130(void) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
gMapTransitionAlpha = 0x00;
D_800A0942 = 0x14;
@ -48,7 +48,7 @@ s32 func_800363FC(void) {
}
s32 func_80036430(void) {
player_status* pPlayerStatus = &gPlayerStatus;
PlayerStatus* pPlayerStatus = &gPlayerStatus;
gMapTransitionAlpha = 0xFF;
D_800A0942 = 0x14;

View File

@ -42,9 +42,9 @@ INCLUDE_ASM(code_13870_len_6980, render_npcs);
INCLUDE_ASM(code_13870_len_6980, npc_move_heading);
npc* INCLUDE_ASM(code_13870_len_6980, get_npc_unsafe, s32 npcID);
Npc* INCLUDE_ASM(code_13870_len_6980, get_npc_unsafe, s32 npcID);
npc* INCLUDE_ASM(code_13870_len_6980, get_npc_safe, s32 npcID);
Npc* INCLUDE_ASM(code_13870_len_6980, get_npc_safe, s32 npcID);
INCLUDE_ASM(code_13870_len_6980, enable_npc_shadow);

View File

@ -2,13 +2,13 @@
INCLUDE_ASM(code_1f580_len_1940, SetEncounterStatusFlags);
s32 LoadDemoBattle(script_context* script) {
s32 LoadDemoBattle(Script* script) {
load_demo_battle(get_variable(script, *script->ptrReadPos));
return 2;
}
// ???
s32 func_80044290(script_context* script) {
s32 func_80044290(Script* script) {
return 2;
}
@ -20,7 +20,7 @@ INCLUDE_ASM(code_1f580_len_1940, RemoveEncounter);
INCLUDE_ASM(code_1f580_len_1940, GetBattleOutcome);
s32 GetOwnerEncountered(script_context* script) {
s32 GetOwnerEncountered(Script* script) {
set_variable(script, *script->ptrReadPos, script->ownerActorID->encountered);
return 2;
}
@ -29,12 +29,12 @@ INCLUDE_ASM(code_1f580_len_1940, DoNpcDefeat);
INCLUDE_ASM(code_1f580_len_1940, start_battle);
s32 StartBattle(script_context* script) {
s32 StartBattle(Script* script) {
start_battle(script, -1);
return 1;
}
s32 StartBattleWith(script_context* script) {
s32 StartBattleWith(Script* script) {
start_battle(script, get_variable(script, *script->ptrReadPos));
return 1;
}
@ -75,14 +75,14 @@ INCLUDE_ASM(code_1f580_len_1940, GetNpcVar);
INCLUDE_ASM(code_1f580_len_1940, SetSelfRotation);
s32 SetSelfEnemyFlags(script_context* script) {
s32 SetSelfEnemyFlags(Script* script) {
script->ownerActorID->flags = *script->ptrReadPos;
return 2;
}
INCLUDE_ASM(code_1f580_len_1940, SetSelfEnemyFlagBits);
s32 GetSelfNpcID(script_context* script) {
s32 GetSelfNpcID(Script* script) {
set_variable(script, *script->ptrReadPos, script->ownerActorID->npcID);
return 2;
}

View File

@ -1,7 +1,7 @@
#include "common.h"
void clear_player_data(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
D_8010CD10 = 0;
@ -95,12 +95,12 @@ void clear_player_data(void) {
playerData->smashGameRecord = 0;
}
player_data* get_player_data(void) {
PlayerData* get_player_data(void) {
return &gPlayerData;
}
s32 add_item(s32 itemID) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
sort_items();
@ -120,7 +120,7 @@ s32 add_item(s32 itemID) {
}
s32 get_item_count(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i = 0;
s32 sum = 0;
@ -138,8 +138,8 @@ s32 get_item_empty_count(void) {
}
s32 find_item(s32 itemID) {
player_data* playerData = &gPlayerData;
item_table_entry* item = &gItemTable[itemID];
PlayerData* playerData = &gPlayerData;
Item* item = &gItemTable[itemID];
s32 i;
if ((item->typeFlags & 8) != 0) {
@ -170,7 +170,7 @@ s32 find_item(s32 itemID) {
}
void sort_items(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
int j;
int i;
@ -189,8 +189,8 @@ void sort_items(void) {
}
s32 add_badge(s32 itemID) {
player_data* playerData = &gPlayerData;
item_table_entry* item = &gItemTable[itemID];
PlayerData* playerData = &gPlayerData;
Item* item = &gItemTable[itemID];
s32 i;
if ((item->typeFlags & 0x40) == 0) {
@ -212,7 +212,7 @@ s32 add_badge(s32 itemID) {
}
s32 store_item(s32 itemID) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
for (i = 0; i < ARRAY_COUNT(gPlayerData.storedItems); i++) {
@ -231,7 +231,7 @@ s32 store_item(s32 itemID) {
}
s32 get_stored_count(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i = 0;
s32 sum = 0;
@ -249,8 +249,8 @@ s32 get_stored_empty_count(void) {
}
void enforce_hpfp_limits(void) {
player_data* playerData = &gPlayerData;
player_data* playerData2 = &gPlayerData;
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData;
playerData->curMaxHP = playerData->hardMaxHP + (is_ability_active(4) * 5);
if (playerData->curMaxHP > 75) {
@ -278,7 +278,7 @@ INCLUDE_ASM(code_80850_len_3060, status_menu_draw_stat);
INCLUDE_ASM(code_80850_len_3060, update_status_menu);
void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
s32 iconIndex;
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->frameCounter % 3) == 0)) {
@ -297,8 +297,8 @@ void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
}
void update_coin_counter(void) {
ui_status* uiStatus = &gUIStatus;
player_data* playerData = &gPlayerData;
UiStatus* uiStatus = &gUIStatus;
PlayerData* playerData = &gPlayerData;
do {} while(0); // Needed to match
@ -337,7 +337,7 @@ void update_coin_counter(void) {
}
void show_coin_counter(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
s16* coinCounterUnk = &D_8010CD10;
s32 index;
@ -378,7 +378,7 @@ void show_coin_counter(void) {
}
void hide_coin_counter(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if ((D_8010CD10 != 0) && (uiStatus->unk_6C[0]== 0)) {
uiStatus->unk_6C[0] = 60;
@ -386,14 +386,14 @@ void hide_coin_counter(void) {
}
void func_800E96C8(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if ((D_8010CD10 != 0) && (uiStatus->unk_6C[0]== 0)) {
uiStatus->unk_6C[0]= 1;
}
}
s32 ShowCoinCounter(script_context* script) {
s32 ShowCoinCounter(Script* script) {
if (get_variable(script, *script->ptrReadPos)) {
show_coin_counter();
} else {
@ -408,7 +408,7 @@ void func_800E973C(void) {
}
void open_status_menu_long(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->hidden) {
uiStatus->showTimer = 210;
@ -418,7 +418,7 @@ void open_status_menu_long(void) {
}
void open_status_menu_short(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->hidden) {
uiStatus->showTimer = 105;
@ -428,7 +428,7 @@ void open_status_menu_short(void) {
}
void func_800E97B8(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->hidden != 1) {
uiStatus->hidden = 1;
@ -438,7 +438,7 @@ void func_800E97B8(void) {
}
void func_800E97E4(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
uiStatus->drawPosY = -100;
uiStatus->ignoreChanges = 0;
@ -449,7 +449,7 @@ void func_800E97E4(void) {
}
void func_800E9810(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
uiStatus->showTimer = 210;
uiStatus->drawPosY = 0;
@ -468,8 +468,8 @@ void func_800E984C(void) {
}
s32 func_800E9860(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
s32 ret = 1 - uiStatus->unk_45[0];
if (uiStatus->unk_45[1] != 0) {
@ -486,7 +486,7 @@ void status_menu_enable_ignore_changes(void) {
}
void func_800E98A8(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
uiStatus->ignoreChanges = 1;
uiStatus->drawPosY = 18;
@ -497,7 +497,7 @@ void status_menu_disable_ignore_changes(void) {
}
s32 func_800E98D4(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
return uiStatus->unk_45[1] + uiStatus->ignoreChanges;
}
@ -515,9 +515,9 @@ s32 is_status_menu_visible(void) {
}
void status_menu_start_blinking_hp(void) {
game_status* gameStatus = (*gGameStatusPtr);
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
GameStatus* gameStatus = (*gGameStatusPtr);
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
uiStatus->hpBlinkTimer = 120;
@ -530,7 +530,7 @@ void status_menu_start_blinking_hp(void) {
}
void status_menu_stop_blinking_hp(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->hpBlinking != 0) {
uiStatus->hpBlinking = 0;
@ -540,9 +540,9 @@ void status_menu_stop_blinking_hp(void) {
}
void status_menu_start_blinking_fp(void) {
game_status* gameStatus = (*gGameStatusPtr);
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
GameStatus* gameStatus = (*gGameStatusPtr);
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
uiStatus->fpBlinkTimer = 120;
@ -555,7 +555,7 @@ void status_menu_start_blinking_fp(void) {
}
void status_menu_stop_blinking_fp(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->fpBlinking != 0) {
uiStatus->fpBlinking = 0;
@ -564,9 +564,9 @@ void status_menu_stop_blinking_fp(void) {
}
void status_menu_start_blinking_coins(void) {
game_status* gameStatus = (*gGameStatusPtr);
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
GameStatus* gameStatus = (*gGameStatusPtr);
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
uiStatus->coinsBlinkTimer = 120;
@ -579,7 +579,7 @@ void status_menu_start_blinking_coins(void) {
}
void status_menu_stop_blinking_coins(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->coinsBlinking != 0) {
uiStatus->coinsBlinking = 0;
@ -589,8 +589,8 @@ void status_menu_stop_blinking_coins(void) {
}
void status_menu_start_blinking_sp(void) {
player_data* playerData = &gPlayerData;
ui_status* uiStatus = &gUIStatus;
PlayerData* playerData = &gPlayerData;
UiStatus* uiStatus = &gUIStatus;
uiStatus->spBarsToBlink = playerData->maxStarPower;
if (uiStatus->spBlinking != 1) {
@ -600,7 +600,7 @@ void status_menu_start_blinking_sp(void) {
}
void status_menu_stop_blinking_sp(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->spBlinking != 0) {
uiStatus->spBlinking = 0;
@ -609,7 +609,7 @@ void status_menu_stop_blinking_sp(void) {
}
void status_menu_start_blinking_sp_bars(s8 numBarsToBlink) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
uiStatus->spBarsToBlink = numBarsToBlink;
if (uiStatus->spBlinking != 1) {
@ -619,7 +619,7 @@ void status_menu_start_blinking_sp_bars(s8 numBarsToBlink) {
}
void status_menu_start_blinking_starpoints(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->starpointsBlinking != 1) {
uiStatus->starpointsBlinking = 1;
@ -628,7 +628,7 @@ void status_menu_start_blinking_starpoints(void) {
}
void status_menu_stop_blinking_starpoints(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->starpointsBlinking != 0) {
uiStatus->starpointsBlinking = 0;
@ -637,7 +637,7 @@ void status_menu_stop_blinking_starpoints(void) {
}
void decrement_status_menu_disabled(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
if (uiStatus->disabled > 0) {
uiStatus->disabled--;
@ -645,14 +645,14 @@ void decrement_status_menu_disabled(void) {
}
void increment_status_menu_disabled(void) {
ui_status* uiStatus = &gUIStatus;
UiStatus* uiStatus = &gUIStatus;
uiStatus->disabled++;
}
void sync_status_menu(void) {
player_data* playerData = &gPlayerData;
ui_status* uiStatus = &gUIStatus;
PlayerData* playerData = &gPlayerData;
UiStatus* uiStatus = &gUIStatus;
uiStatus->displayHP = playerData->curHP;
uiStatus->displayFP = playerData->curFP;
@ -662,8 +662,8 @@ void sync_status_menu(void) {
}
void reset_status_menu(void) {
player_data* playerData = &gPlayerData;
ui_status* uiStatus = &gUIStatus;
PlayerData* playerData = &gPlayerData;
UiStatus* uiStatus = &gUIStatus;
s32 i;
uiStatus->drawPosX = 12;
@ -971,7 +971,7 @@ s32 is_partner_ability_active(void) {
}
s16 add_coins(s32 amt) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s16 newCoins = playerData->coins + amt;
playerData->coins = newCoins;
@ -992,8 +992,8 @@ s16 add_coins(s32 amt) {
}
s8 add_star_points(s32 amt) {
player_data* playerData = &gPlayerData;
player_data* playerData2 = &gPlayerData;
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData;
s8 newSP = playerData->starPoints + amt;
// TODO: probably a macro!
@ -1011,8 +1011,8 @@ s8 add_star_points(s32 amt) {
}
u8 add_star_pieces(s32 amt) {
player_data* playerData = &gPlayerData;
player_data* playerData2 = &gPlayerData;
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData;
s32 newSP = playerData->starPieces;
newSP += amt;
@ -1032,24 +1032,24 @@ u8 add_star_pieces(s32 amt) {
}
void increment_max_SP() {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
playerData->maxStarPower++;
playerData->specialBarsFilled = playerData->maxStarPower * 256;
}
void set_max_SP(s8 newMaxSP) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
playerData->maxStarPower = newMaxSP;
playerData->specialBarsFilled = newMaxSP * 256;
}
void add_SP(s32 amt) {
player_data* playerData = &gPlayerData;
player_data* playerData2 = &gPlayerData;
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData;
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
s32 phi_v1;
s32 blah;
@ -1073,7 +1073,7 @@ void add_SP(s32 amt) {
}
s32 recover_fp(s32 amt) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 newFP = playerData->curFP;
s32 ret;
@ -1095,7 +1095,7 @@ s32 recover_fp(s32 amt) {
}
s32 recover_hp(s32 amt) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 newHP = playerData->curHP;
s32 ret;
@ -1117,7 +1117,7 @@ s32 recover_hp(s32 amt) {
}
void subtract_hp(s32 amt) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 newHP = playerData->curHP;
if (amt > 0) {
@ -1130,27 +1130,27 @@ void subtract_hp(s32 amt) {
}
s8 has_full_hp(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
return playerData->curMaxHP == playerData->curHP;
}
s8 has_full_fp(void) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
return playerData->curMaxFP == playerData->curFP;
}
s8 add_fortress_keys(s32 amt) {
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
playerData->fortressKeyCount += amt;
return playerData->fortressKeyCount;
}
s8 subtract_fortress_keys(s8 amt) {
player_data* playerData = &gPlayerData;
player_data* playerData2 = &gPlayerData; // required to match
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData; // required to match
playerData->fortressKeyCount -= amt;
if (playerData->fortressKeyCount < 0) {

View File

@ -23,7 +23,7 @@ INCLUDE_ASM(code_dbd70_len_700, create_trigger);
INCLUDE_ASM(code_dbd70_len_700, update_triggers);
void delete_trigger(trigger* toDelete) {
void delete_trigger(Trigger* toDelete) {
s32 i;
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
@ -41,7 +41,7 @@ void delete_trigger(trigger* toDelete) {
INCLUDE_ASM(code_dbd70_len_700, is_trigger_bound);
//INCLUDE_ASM(code_dbd70_len_700, get_trigger_by_id);
trigger* get_trigger_by_id(s32 triggerID) {
Trigger* get_trigger_by_id(s32 triggerID) {
return (*gCurrentTriggerListPtr)[triggerID];
}

View File

@ -23,7 +23,7 @@ void load_map_bg(char* optAssetName) {
}
void func_80145DF8(void) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
D_801595A0 = 0;
D_8014F12F = 0;
@ -31,8 +31,8 @@ void func_80145DF8(void) {
gameStatus->enableBackground &= 0xF0;
}
void read_background_size(bg_header *bg) {
game_status* gameStatus = *gGameStatusPtr;
void read_background_size(BackgroundHeader *bg) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->backgroundMaxW = bg->width;
gameStatus->backgroundMaxH = bg->height;
@ -44,7 +44,7 @@ void read_background_size(bg_header *bg) {
}
void set_background_size(s16 startX, s16 startY, s16 sizeX, s16 sizeY) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->enableBackground &= ~1;
gameStatus->backgroundMaxW = startX;

View File

@ -50,7 +50,7 @@ INCLUDE_ASM(code_e79b0_len_1920, kill_script);
void* kill_script_by_ID(s32 id) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -62,7 +62,7 @@ void* kill_script_by_ID(s32 id) {
s32 kill_all_scripts(void) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -75,7 +75,7 @@ s32 kill_all_scripts(void) {
s32 does_script_exist(s32 id) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -86,7 +86,7 @@ s32 does_script_exist(s32 id) {
return 0;
}
s32 does_script_exist_by_ref(script_context* script) {
s32 does_script_exist_by_ref(Script* script) {
s32 i;
for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
@ -97,11 +97,11 @@ s32 does_script_exist_by_ref(script_context* script) {
return 0;
}
void set_script_priority(script_context* script, s8 priority) {
void set_script_priority(Script* script, s8 priority) {
script->priority = priority;
}
void set_script_timescale(script_context* script, f32 timeScale) {
void set_script_timescale(Script* script, f32 timeScale) {
script->timeScale = timeScale * gGlobalTimeSpace;
}
@ -122,7 +122,7 @@ f32 get_global_timespace(void) {
}
*/
void set_script_group(script_context* script, s8 groupFlags) {
void set_script_group(Script* script, s8 groupFlags) {
script->groupFlags = groupFlags;
}
@ -130,10 +130,10 @@ INCLUDE_ASM(code_e79b0_len_1920, bind_trigger);
INCLUDE_ASM(code_e79b0_len_1920, bind_trigger_1);
void suspend_group_script(script_context* script, s32 groupFlags) {
void suspend_group_script(Script* script, s32 groupFlags) {
int i;
script_context* scriptContextPtr;
script_context* childScript = script->childScript;
Script* scriptContextPtr;
Script* childScript = script->childScript;
if (childScript != NULL) {
suspend_group_script(childScript, groupFlags);
@ -151,10 +151,10 @@ void suspend_group_script(script_context* script, s32 groupFlags) {
}
}
void resume_group_script(script_context* script, s32 groupFlags) {
void resume_group_script(Script* script, s32 groupFlags) {
int i;
script_context* scriptContextPtr;
script_context* childScript = script->childScript;
Script* scriptContextPtr;
Script* childScript = script->childScript;
if (childScript != NULL) {
resume_group_script(childScript, groupFlags);
@ -174,7 +174,7 @@ void resume_group_script(script_context* script, s32 groupFlags) {
s32 suspend_all_script(s32 id) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -186,7 +186,7 @@ s32 suspend_all_script(s32 id) {
s32 resume_all_script(s32 id) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -198,7 +198,7 @@ s32 resume_all_script(s32 id) {
void suspend_group_script_index(s32 id, s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -210,7 +210,7 @@ void suspend_group_script_index(s32 id, s32 groupFlags) {
void resume_group_script_index(s32 id, s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -222,7 +222,7 @@ void resume_group_script_index(s32 id, s32 groupFlags) {
s32 suspend_all_group(s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -234,7 +234,7 @@ s32 suspend_all_group(s32 groupFlags) {
s32 resume_all_group(s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -247,7 +247,7 @@ s32 resume_all_group(s32 groupFlags) {
void suspend_group_others(s32 script, s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -259,7 +259,7 @@ void suspend_group_others(s32 script, s32 groupFlags) {
void resume_group_others(s32 script, s32 groupFlags) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
@ -269,13 +269,13 @@ void resume_group_others(s32 script, s32 groupFlags) {
}
}
script_context* get_script_by_index(s32 index) {
Script* get_script_by_index(s32 index) {
return (*gCurrentScriptListPtr)[index];
}
script_context* get_script_by_id(s32 id) {
Script* get_script_by_id(s32 id) {
s32 i;
script_context* scriptContextPtr;
Script* scriptContextPtr;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
if ((*gCurrentScriptListPtr)[i] != NULL) {
@ -288,10 +288,10 @@ script_context* get_script_by_id(s32 id) {
return 0;
}
void set_script_flags(script_context* script, s32 flags) {
void set_script_flags(Script* script, s32 flags) {
int i;
script_context* scriptContextPtr;
script_context* childScript = script->childScript;
Script* scriptContextPtr;
Script* childScript = script->childScript;
script->state |= flags;
if (childScript != NULL) {

View File

@ -13,16 +13,16 @@ INCLUDE_ASM(code_e92d0_len_5da0, float_to_fixed_var);
return (s32)(arg0 * (f32)1024.0f) + -230000000;
}*/
s32 si_handle_return(script_context* script) {
s32 si_handle_return(Script* script) {
kill_script(script);
return 255;
}
s32 si_handle_label(script_context* script) {
s32 si_handle_label(Script* script) {
return 2;
}
s32 si_handle_goto(script_context* script) {
s32 si_handle_goto(Script* script) {
script->ptrNextLine = si_goto_label(script, get_variable(script, *script->ptrReadPos));
return 2;
}
@ -31,7 +31,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_Loop);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_end_loop);
s32 si_handle_break_loop(script_context* script) {
s32 si_handle_break_loop(Script* script) {
if (script->loopDepth < 0) {
while (1) {}; // todo INF_LOOP
}
@ -56,7 +56,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_if_less_equal);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_if_greater_equal);
s32 si_handle_if_AND(script_context* script) {
s32 si_handle_if_AND(Script* script) {
s32 var1;
s32 *ptrReadPos = script->ptrReadPos;
@ -71,7 +71,7 @@ s32 si_handle_if_AND(script_context* script) {
}
//INCLUDE_ASM(code_e92d0_len_5da0, si_handle_if_not_AND);
s32 si_handle_if_not_AND(script_context* script) {
s32 si_handle_if_not_AND(Script* script) {
s32 var1;
s32 *ptrReadPos = script->ptrReadPos;
@ -85,12 +85,12 @@ s32 si_handle_if_not_AND(script_context* script) {
return 2;
}
s32 si_handle_else(script_context* script) {
s32 si_handle_else(Script* script) {
script->ptrNextLine = si_skip_else(script);
return 2;
}
s32 si_handle_end_if(script_context* script) {
s32 si_handle_end_if(Script* script) {
return 2;
}
@ -133,7 +133,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_case_equal_AND);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_end_case_group);
s32 si_handle_break_case(script_context* script) {
s32 si_handle_break_case(Script* script) {
if (script->switchDepth < 0) {
while (1) {}; //todo INF_LOOP
}
@ -141,7 +141,7 @@ s32 si_handle_break_case(script_context* script) {
return 2;
}
s32 si_handle_end_switch(script_context* script) {
s32 si_handle_end_switch(Script* script) {
s32 switchDepth = script->switchDepth;
if (switchDepth < 0) {
@ -154,7 +154,7 @@ s32 si_handle_end_switch(script_context* script) {
}
s32 si_handle_set_var(script_context* script) {
s32 si_handle_set_var(Script* script) {
s32* ptrReadPos = script->ptrReadPos;
s32 curPtrReadPos = ptrReadPos[0];
@ -162,12 +162,12 @@ s32 si_handle_set_var(script_context* script) {
return 2;
}
s32 si_handle_set_const(script_context* script) {
s32 si_handle_set_const(Script* script) {
set_variable(script, *script->ptrReadPos, script->ptrReadPos[1]);
return 2;
}
s32 si_handle_set_float(script_context* script) {
s32 si_handle_set_float(Script* script) {
s32* ptrReadPos = script->ptrReadPos;
s32 curPtrReadPos = ptrReadPos[0];
@ -193,17 +193,17 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_multiplyF);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_divideF);
s32 si_handle_set_int_buffer_ptr(script_context* script) {
s32 si_handle_set_int_buffer_ptr(Script* script) {
script->buffer = get_variable(script, *script->ptrReadPos);
return 2;
}
s32 si_handle_set_float_buffer_ptr(script_context* script) {
s32 si_handle_set_float_buffer_ptr(Script* script) {
script->buffer = get_variable(script, *script->ptrReadPos);
return 2;
}
s32 si_handle_get_1_word(script_context* script) {
s32 si_handle_get_1_word(Script* script) {
s32 ptrReadPos = *script->ptrReadPos;
s32 buffer = *script->buffer++;
@ -217,7 +217,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_get_3_word);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_get_4_word);
s32 si_handle_get_Nth_word(script_context* script) {
s32 si_handle_get_Nth_word(Script* script) {
s32* ptrReadPos = script->ptrReadPos;
s32 curPtrReadPos = ptrReadPos[0];
@ -235,12 +235,12 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_get_4_float);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_get_Nth_float);
s32 si_handle_set_array(script_context* script) {
s32 si_handle_set_array(Script* script) {
script->array = get_variable(script, *script->ptrReadPos);
return 2;
}
s32 si_handle_set_flag_array(script_context* script) {
s32 si_handle_set_flag_array(Script* script) {
script->flagArray = get_variable(script, *script->ptrReadPos);
return 2;
}
@ -250,7 +250,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_allocate_array);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_AND);
//INCLUDE_ASM(code_e92d0_len_5da0, si_handle_AND_const);
s32 si_handle_AND_const(script_context* script) {
s32 si_handle_AND_const(Script* script) {
s32* ptrReadPos = script->ptrReadPos;
// todo ???
s32 temp_s0 = ptrReadPos[0];
@ -265,7 +265,7 @@ s32 si_handle_AND_const(script_context* script) {
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_OR);
//INCLUDE_ASM(code_e92d0_len_5da0, si_handle_OR_const);
s32 si_handle_OR_const(script_context* script) {
s32 si_handle_OR_const(Script* script) {
s32* ptrReadPos = script->ptrReadPos;
// todo ???
s32 temp_s0 = ptrReadPos[0];
@ -283,13 +283,13 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_exec1);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_exec2);
s32 si_handle_exec_wait(script_context* script) {
s32 si_handle_exec_wait(Script* script) {
start_child_script(script, get_variable(script, *script->ptrReadPos), 0);
script->currentOpcode = 0;
return 0xFF;
}
s32 si_handle_jump(script_context* script) {
s32 si_handle_jump(Script* script) {
script->ptrFirstLine = get_variable(script, *script->ptrReadPos);
restart_script(script);
return 2;
@ -299,62 +299,62 @@ INCLUDE_ASM(code_e92d0_len_5da0, _bound_script_trigger_handler);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_bind);
s32 DeleteTrigger(script_context* script) {
s32 DeleteTrigger(Script* script) {
delete_trigger(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_unbind(script_context* script) {
s32 si_handle_unbind(Script* script) {
delete_trigger(script->ownerID);
return 2;
}
s32 si_handle_kill(script_context* script) {
s32 si_handle_kill(Script* script) {
kill_script_by_ID(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_set_priority(script_context* script) {
s32 si_handle_set_priority(Script* script) {
set_script_priority(script, get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_set_timescale(script_context* script) {
s32 si_handle_set_timescale(Script* script) {
set_script_timescale(script, get_float_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_set_group(script_context* script) {
s32 si_handle_set_group(Script* script) {
set_script_group(script, get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_suspend_all(script_context* script) {
s32 si_handle_suspend_all(Script* script) {
suspend_all_group(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_resume_all(script_context* script) {
s32 si_handle_resume_all(Script* script) {
resume_all_group(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_suspend_others(script_context* script) {
s32 si_handle_suspend_others(Script* script) {
suspend_group_others(script, get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_resume_others(script_context* script) {
s32 si_handle_resume_others(Script* script) {
resume_group_others(script, get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_suspend(script_context* script) {
s32 si_handle_suspend(Script* script) {
suspend_all_script(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 si_handle_resume(script_context* script) {
s32 si_handle_resume(Script* script) {
resume_all_script(get_variable(script, *script->ptrReadPos));
return 2;
}
@ -365,34 +365,34 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_handle_bind_lock);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_thread);
s32 si_handle_end_thread(script_context* script) {
s32 si_handle_end_thread(Script* script) {
kill_script(script);
return 255;
}
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_child_thread);
s32 si_handle_end_child_thread(script_context* script) {
s32 si_handle_end_child_thread(Script* script) {
kill_script(script);
return 0;
}
s32 func_802C6E14(script_context* script) {
s32 func_802C6E14(Script* script) {
return 2;
}
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_print_debug_var);
s32 func_802C739C(script_context* script) {
s32 func_802C739C(Script* script) {
script->ptrSavedPosition = *script->ptrReadPos;
return 2;
}
s32 func_802C73B0(script_context* script) {
s32 func_802C73B0(Script* script) {
return 2;
}
s32 func_802C73B8(script_context* script) {
s32 func_802C73B8(Script* script) {
s32 i;
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
@ -407,17 +407,17 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_execute_next_command);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_end);
s32 INCLUDE_ASM(code_e92d0_len_5da0, get_variable, script_context* script, bytecode var);
s32 INCLUDE_ASM(code_e92d0_len_5da0, get_variable, Script* script, bytecode var);
INCLUDE_ASM(code_e92d0_len_5da0, get_variable_index);
INCLUDE_ASM(code_e92d0_len_5da0, get_variable_index_alt);
s32 INCLUDE_ASM(code_e92d0_len_5da0, set_variable, script_context* script, bytecode var, s32 value);
s32 INCLUDE_ASM(code_e92d0_len_5da0, set_variable, Script* script, bytecode var, s32 value);
f32 INCLUDE_ASM(code_e92d0_len_5da0, get_float_variable, script_context* script, bytecode var);
f32 INCLUDE_ASM(code_e92d0_len_5da0, get_float_variable, Script* script, bytecode var);
f32 INCLUDE_ASM(code_e92d0_len_5da0, set_float_variable, script_context* script, bytecode var, f32 value);
f32 INCLUDE_ASM(code_e92d0_len_5da0, set_float_variable, Script* script, bytecode var, f32 value);
INCLUDE_ASM(code_e92d0_len_5da0, si_goto_label);
@ -439,7 +439,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, ScaleModel);
INCLUDE_ASM(code_e92d0_len_5da0, GetModelIndex);
s32 CloneModel(script_context* script) {
s32 CloneModel(Script* script) {
s32* thisPos = script->ptrReadPos;
s32 srcModelID = get_variable(script, *thisPos++);
s32 newModelID = get_variable(script, *thisPos++);
@ -484,7 +484,7 @@ INCLUDE_ASM(code_e92d0_len_5da0, GetColliderCenter);
INCLUDE_ASM(code_e92d0_len_5da0, ParentColliderToModel);
s32 UpdateColliderTransform(script_context* script) {
s32 UpdateColliderTransform(Script* script) {
update_collider_transform(get_variable(script, *script->ptrReadPos));
return 2;
}
@ -493,32 +493,32 @@ INCLUDE_ASM(code_e92d0_len_5da0, func_802CA1B8);
INCLUDE_ASM(code_e92d0_len_5da0, goto_map);
s32 GotoMap(script_context* script) {
s32 GotoMap(Script* script) {
goto_map(script, 0);
return 1;
}
s32 GotoMapSpecial(script_context* script) {
s32 GotoMapSpecial(Script* script) {
goto_map(script, 1);
return 1;
}
s32 GotoMapByID(script_context* script) {
s32 GotoMapByID(Script* script) {
goto_map(script, 2);
return 1;
}
s32 GetEntryID(script_context* script) {
s32 GetEntryID(Script* script) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->entryID);
return 2;
}
s32 GetMapID(script_context* script, s32 initialCall) {
s32 GetMapID(Script* script, s32 initialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->mapID);
return 2;
}
s32 GetLoadType(script_context* script, s32 initialCall) {
s32 GetLoadType(Script* script, s32 initialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->loadType != 0);
return 2;
}

View File

@ -1,13 +1,13 @@
#include "common.h"
void func_800337D0(s16 new_alpha) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->bootAlpha = new_alpha;
}
void func_800337E0(s16 arg0) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->bootRed = arg0;
gameStatus->bootGreen = arg0;
@ -15,7 +15,7 @@ void func_800337E0(s16 arg0) {
}
s16 func_800337F8(subtract_val) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->bootAlpha != 0) {
gameStatus->bootAlpha -= subtract_val;
@ -29,7 +29,7 @@ s16 func_800337F8(subtract_val) {
}
s16 func_80033830(add_val) {
game_status* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->bootAlpha != 0xFF) {
gameStatus->bootAlpha += add_val;

View File

@ -1,20 +1,20 @@
#include "common.h"
npc* resolve_npc(script_context* script, NPC npcID) {
Npc* resolve_npc(Script* script, NPC npcID) {
if (npcID == NPC_SELF) {
return get_npc_safe(script->ownerID);
} else if (npcID >= -270000000) {
return get_npc_safe(npcID);
} else {
return (npc*) npcID;
return (Npc*) npcID;
}
}
INCLUDE_ASM(code_f2470_len_27f0, set_npc_animation);
s32 DeleteNpc(script_context* script, s32 initialCall) {
s32 DeleteNpc(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
Npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
if (npcPtr) {
free_npc(npcPtr);
@ -23,7 +23,7 @@ s32 DeleteNpc(script_context* script, s32 initialCall) {
return 2;
}
s32 GetNpcPointer(script_context* script, s32 initialCall) {
s32 GetNpcPointer(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode npcID = get_variable(script, *ptrReadPos++);
bytecode varNPC = *ptrReadPos++;

View File

@ -1,18 +1,18 @@
#include "common.h"
s32 SpeakToPlayer(script_context* script, s32 initialCall) {
s32 SpeakToPlayer(Script* script, s32 initialCall) {
return _show_message(script, initialCall, 0);
}
s32 EndSpeech(script_context* script, s32 initialCall) {
s32 EndSpeech(Script* script, s32 initialCall) {
return _show_message(script, initialCall, 1);
}
s32 ContinueSpeech(script_context* script, s32 initialCall) {
s32 ContinueSpeech(Script* script, s32 initialCall) {
return _show_message(script, initialCall, 2);
}
s32 SpeakToNpc(script_context* script, s32 initialCall) {
s32 SpeakToNpc(Script* script, s32 initialCall) {
return _show_message(script, initialCall, 3);
}
@ -28,27 +28,27 @@ INCLUDE_ASM(code_f4c60_len_4300, SwitchMessage);
INCLUDE_ASM(code_f4c60_len_4300, ShowChoice);
s32 CloseChoice(script_context* script, s32 initialCall) {
s32 CloseChoice(Script* script, s32 initialCall) {
close_message(D_802DB268);
return 1;
}
s32 CancelMessage(script_context* script, s32 initialCall) {
s32 CancelMessage(Script* script, s32 initialCall) {
cancel_message(gCurrentPrintContext);
return 2;
}
s32 CancelMessageAndBlock(script_context* script, s32 initialCall) {
s32 CancelMessageAndBlock(Script* script, s32 initialCall) {
cancel_message(gCurrentPrintContext);
return 0;
}
s32 SetMessageImages(script_context* script, s32 initialCall) {
s32 SetMessageImages(Script* script, s32 initialCall) {
set_message_images(*script->ptrReadPos);
return 2;
}
s32 func_802D0C94(script_context* script, s32 initialCall) {
s32 func_802D0C94(Script* script, s32 initialCall) {
if (get_variable(script, *script->ptrReadPos) == 0) {
D_8009A650[0] |= 0x10;
} else {
@ -57,7 +57,7 @@ s32 func_802D0C94(script_context* script, s32 initialCall) {
return 2;
}
s32 SetMessageString(script_context* script, s32 initialCall) {
s32 SetMessageString(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode string = get_variable(script, *ptrReadPos++);
bytecode index = get_variable(script, *ptrReadPos++);

View File

@ -1,6 +1,6 @@
#include "common.h"
s32 MakeLerp(script_context* script, s32 initialCall) {
s32 MakeLerp(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
script->varTable[0xC] = get_variable(script, *ptrReadPos++); // start
@ -12,7 +12,7 @@ s32 MakeLerp(script_context* script, s32 initialCall) {
return 2;
}
s32 UpdateLerp(script_context* script, s32 initialCall) {
s32 UpdateLerp(Script* script, s32 initialCall) {
script->varTable[0x0] = (s32) update_lerp(
script->varTable[0xB],
script->varTable[0xC],
@ -31,7 +31,7 @@ s32 UpdateLerp(script_context* script, s32 initialCall) {
return 2;
}
s32 RandInt(script_context* script, s32 initialCall) {
s32 RandInt(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
s32 max = get_variable(script, *ptrReadPos++);
@ -42,49 +42,49 @@ s32 RandInt(script_context* script, s32 initialCall) {
return 2;
}
s32 GetAngleBetweenNPCs(script_context* script, s32 initialCall) {
s32 GetAngleBetweenNPCs(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
NPC aID = get_variable(script, *ptrReadPos++);
NPC bID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
npc* a = resolve_npc(script, aID);
npc* b = resolve_npc(script, bID);
Npc* a = resolve_npc(script, aID);
Npc* b = resolve_npc(script, bID);
set_variable(script, outVar, atan2(a->pos.x, a->pos.z, b->pos.x, b->pos.z));
return 2;
}
s32 GetAngleToNPC(script_context* script, s32 initialCall) {
player_status* playerStatus = &gPlayerStatus;
s32 GetAngleToNPC(Script* script, s32 initialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
bytecode* ptrReadPos = script->ptrReadPos;
NPC npcID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
npc* npc = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
set_variable(script, outVar, atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z));
return 2;
}
s32 GetAngleToPlayer(script_context* script, s32 initialCall) {
player_status* playerStatus = &gPlayerStatus;
s32 GetAngleToPlayer(Script* script, s32 initialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
bytecode* ptrReadPos = script->ptrReadPos;
NPC npcID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
npc* npc = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
set_variable(script, outVar, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z));
return 2;
}
s32 AwaitPlayerApproach(script_context* script, s32 initialCall) {
s32 AwaitPlayerApproach(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
player_status* playerStatus = &gPlayerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
s32* targetZ = &script->functionTemp[1];
@ -110,9 +110,9 @@ s32 AwaitPlayerApproach(script_context* script, s32 initialCall) {
}
}
s32 IsPlayerWithin(script_context* script, s32 initialCall) {
s32 IsPlayerWithin(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
player_status* playerStatus = &gPlayerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
s32* targetZ = &script->functionTemp[1];
@ -141,9 +141,9 @@ s32 IsPlayerWithin(script_context* script, s32 initialCall) {
return 2;
}
s32 AwaitPlayerLeave(script_context* script, s32 initialCall) {
s32 AwaitPlayerLeave(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
player_status* playerStatus = &gPlayerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
s32* targetZ = &script->functionTemp[1];
@ -169,7 +169,7 @@ s32 AwaitPlayerLeave(script_context* script, s32 initialCall) {
}
}
s32 AddVectorPolar(script_context* script, s32 initialCall) {
s32 AddVectorPolar(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode xVar = *ptrReadPos++;
@ -236,7 +236,7 @@ s32 func_802D4CC4(script_context* script, s32 initialCall) {
}
*/
s32 func_802D4D18(script_context* script, s32 initialCall) {
s32 func_802D4D18(Script* script, s32 initialCall) {
s32 value = get_float_variable(script, *script->ptrReadPos);
func_80137E4C(0, 0, 0xC, 0x14);
@ -246,7 +246,7 @@ s32 func_802D4D18(script_context* script, s32 initialCall) {
return 2;
}
s32 func_802D4D88(script_context* script, s32 initialCall) {
s32 func_802D4D88(Script* script, s32 initialCall) {
func_80137D88(0xC, 0);
return 2;
}
@ -259,7 +259,7 @@ INCLUDE_ASM(code_f8f60_len_1560, LoadPath);
INCLUDE_ASM(code_f8f60_len_1560, GetNextPathPos);
s32 GetDist2D(script_context* script, s32 initialCall) {
s32 GetDist2D(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode outVar = *ptrReadPos++;
@ -273,12 +273,12 @@ s32 GetDist2D(script_context* script, s32 initialCall) {
return 2;
}
s32 func_802D5830(script_context* script, s32 initialCall) {
s32 func_802D5830(Script* script, s32 initialCall) {
func_80027088(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 func_802D585C(script_context* script, s32 initialCall) {
s32 func_802D585C(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
s32 setMode = get_variable(script, *ptrReadPos++);
s32 flags = get_variable(script, *ptrReadPos++);
@ -294,7 +294,7 @@ s32 func_802D585C(script_context* script, s32 initialCall) {
return 2;
}
s32 SetValueByRef(script_context* script, s32 initialCall) {
s32 SetValueByRef(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
s32 dest = get_variable(script, *ptrReadPos++); /* Reference */
@ -304,7 +304,7 @@ s32 SetValueByRef(script_context* script, s32 initialCall) {
return 2;
}
s32 GetValueByRef(script_context* script, s32 initialCall) {
s32 GetValueByRef(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
s32 src = get_variable(script, *ptrReadPos++); /* Reference */
@ -315,7 +315,7 @@ s32 GetValueByRef(script_context* script, s32 initialCall) {
return 2;
}
s32 EnableStatusMenu(script_context* script, s32 initialCall) {
s32 EnableStatusMenu(Script* script, s32 initialCall) {
if (get_variable(script, *script->ptrReadPos) != 0) {
decrement_status_menu_disabled();
} else {
@ -325,7 +325,7 @@ s32 EnableStatusMenu(script_context* script, s32 initialCall) {
return 2;
}
s32 ShowStatusMenu(script_context* script, s32 initialCall) {
s32 ShowStatusMenu(Script* script, s32 initialCall) {
if (get_variable(script, *script->ptrReadPos) != 0) {
status_menu_enable_ignore_changes();
func_800E97B8();
@ -336,7 +336,7 @@ s32 ShowStatusMenu(script_context* script, s32 initialCall) {
return 2;
}
s32 SetGameMode(script_context* script, s32 initialCall) {
s32 SetGameMode(Script* script, s32 initialCall) {
set_game_mode(
// Clear upper half
(get_variable(script, *script->ptrReadPos) << 0x10) >> 0x10
@ -344,7 +344,7 @@ s32 SetGameMode(script_context* script, s32 initialCall) {
return 2;
}
s32 ClampAngleInt(script_context* script, s32 initialCall) {
s32 ClampAngleInt(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
set_variable(script, *ptrReadPos, clamp_angle(get_variable(script, *ptrReadPos)));
@ -352,7 +352,7 @@ s32 ClampAngleInt(script_context* script, s32 initialCall) {
return 2;
}
s32 ClampAngleFloat(script_context* script, s32 initialCall) {
s32 ClampAngleFloat(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
set_float_variable(script, *ptrReadPos, clamp_angle(get_float_variable(script, *ptrReadPos)));

View File

@ -2,7 +2,7 @@
INCLUDE_ASM(code_fa4c0_len_3bf0, func_802D5B10);
s32 FadeOutMusic(script_context* script, s32 initialCall) {
s32 FadeOutMusic(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = ptrReadPos++;
@ -10,7 +10,7 @@ s32 FadeOutMusic(script_context* script, s32 initialCall) {
return (set_music_track(itemID, -1, 0, get_variable(script, *ptrNextPos++), 8) != 0) * 2;
}
s32 SetMusicTrack(script_context* script, s32 initialCall) {
s32 SetMusicTrack(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 musicPlayer = get_variable(script, *ptrReadPos++);
s32 songID = get_variable(script, *ptrReadPos++);
@ -22,14 +22,14 @@ s32 SetMusicTrack(script_context* script, s32 initialCall) {
INCLUDE_ASM(code_fa4c0_len_3bf0, FadeInMusic);
s32 PlayAmbientSounds(script_context* script, s32 initialCall) {
s32 PlayAmbientSounds(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
return (play_ambient_sounds(soundID, 0xFA) != 0) * 2;
}
s32 PlaySound(script_context* script, s32 initialCall) {
s32 PlaySound(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
@ -37,7 +37,7 @@ s32 PlaySound(script_context* script, s32 initialCall) {
return 2;
}
s32 func_802D617C(script_context* script, s32 initialCall) {
s32 func_802D617C(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
@ -46,7 +46,7 @@ s32 func_802D617C(script_context* script, s32 initialCall) {
return 2;
}
s32 PlaySoundAt(script_context* script, s32 initialCall) {
s32 PlaySoundAt(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
@ -58,28 +58,28 @@ s32 PlaySoundAt(script_context* script, s32 initialCall) {
return 2;
}
s32 StopSound(script_context* script, s32 initialCall) {
s32 StopSound(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
stop_sound(get_variable(script, *ptrReadPos++));
return 2;
}
s32 func_802D62E4(script_context* script, s32 initialCall) {
s32 func_802D62E4(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
func_80149A6C(get_variable(script, *ptrReadPos++), 1);
return 2;
}
s32 UseDoorSounds(script_context* script, s32 initialCall) {
s32 UseDoorSounds(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
gCurrentDoorSoundsSet = get_variable(script, *ptrReadPos++);
return 2;
}
s32 func_802D6340(script_context* script, s32 initialCall) {
s32 func_802D6340(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
D_80151308 = get_variable(script, *ptrReadPos++);
@ -88,7 +88,7 @@ s32 func_802D6340(script_context* script, s32 initialCall) {
INCLUDE_ASM(code_fa4c0_len_3bf0, PlaySoundAtF);
s32 RemoveKeyItemAt(script_context* script, s32 initialCall) {
s32 RemoveKeyItemAt(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 index = get_variable(script, *ptrReadPos++);
s16* ptrKeyItems = (s16 *) &gPlayerData.keyItems;
@ -97,7 +97,7 @@ s32 RemoveKeyItemAt(script_context* script, s32 initialCall) {
return 2;
}
s32 RemoveItemAt(script_context* script, s32 initialCall) {
s32 RemoveItemAt(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 index = get_variable(script, *ptrReadPos++);
s16* ptrInvItems = (s16 *) &gPlayerData.invItems;
@ -107,10 +107,10 @@ s32 RemoveItemAt(script_context* script, s32 initialCall) {
return 2;
}
s32 AddKeyItem(script_context* script, s32 initialCall) {
s32 AddKeyItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 value = *ptrReadPos++;
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 itemID = get_variable(script, value);
s32 i;
@ -139,11 +139,11 @@ s32 func_802D6954(void) {
return 2;
}
s32 HasKeyItem(script_context* script, s32 initialCall) {
s32 HasKeyItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32 value = *ptrReadPos++;
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
for(i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
@ -155,11 +155,11 @@ s32 HasKeyItem(script_context* script, s32 initialCall) {
return 2;
}
s32 FindKeyItem(script_context* script, s32 initialCall) {
s32 FindKeyItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32 value = *ptrReadPos++;
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
s32 itemIndex;
@ -178,7 +178,7 @@ s32 FindKeyItem(script_context* script, s32 initialCall) {
return 2;
}
s32 AddItem(script_context* script, s32 initialCall) {
s32 AddItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = (s32 *) *ptrReadPos++;
@ -187,16 +187,16 @@ s32 AddItem(script_context* script, s32 initialCall) {
return 2;
}
s32 func_802D6AF0(script_context* script, s32 initialCall) {
s32 func_802D6AF0(Script* script, s32 initialCall) {
set_variable(script, *script->ptrReadPos, 0);
return 2;
}
s32 FindItem(script_context* script, s32 initialCall) {
s32 FindItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32 value = *ptrReadPos++;
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
s32 itemIndex;
@ -215,11 +215,11 @@ s32 FindItem(script_context* script, s32 initialCall) {
return 2;
}
s32 RemoveItem(script_context* script, s32 initialCall) {
s32 RemoveItem(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32 value = *ptrReadPos++;
player_data* playerData = &gPlayerData;
PlayerData* playerData = &gPlayerData;
s32 i;
s32 itemIndex;
@ -245,14 +245,14 @@ s32 RemoveItem(script_context* script, s32 initialCall) {
return 2;
}
s32 CountFortressKeys(script_context* script, s32 initialCall) {
s32 CountFortressKeys(Script* script, s32 initialCall) {
s32 outVar = *script->ptrReadPos;
set_variable(script, outVar, get_fortress_key_count());
return 2;
}
s32 RemoveFortressKeys(script_context* script, s32 initialCall) {
s32 RemoveFortressKeys(Script* script, s32 initialCall) {
s32 num = get_variable(script, *script->ptrReadPos);
subtract_fortress_keys(num);
@ -281,7 +281,7 @@ s32 DropItemEntityB(script_context* script, s32 initialCall) {
}
*/
s32 RemoveItemEntity(script_context* script, s32 initialCall) {
s32 RemoveItemEntity(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemEntityIndex = get_variable(script, *ptrReadPos++);
@ -289,7 +289,7 @@ s32 RemoveItemEntity(script_context* script, s32 initialCall) {
return 2;
}
s32 AddBadge(script_context* script, s32 initialCall) {
s32 AddBadge(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = (s32 *) *ptrReadPos++;
@ -300,9 +300,9 @@ s32 AddBadge(script_context* script, s32 initialCall) {
INCLUDE_ASM(code_fa4c0_len_3bf0, RemoveBadge);
s32 SetItemPos(script_context* script, s32 initialCall) {
s32 SetItemPos(Script* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
item_entity* ptrItemEntity;
ItemEntity* ptrItemEntity;
s32 itemEntityIndex;
s32 x, y, z;
@ -311,7 +311,7 @@ s32 SetItemPos(script_context* script, s32 initialCall) {
y = get_variable(script, *ptrReadPos++);
z = get_variable(script, *ptrReadPos++);
ptrItemEntity = (item_entity *) get_item_entity(itemEntityIndex);
ptrItemEntity = (ItemEntity *) get_item_entity(itemEntityIndex);
ptrItemEntity->position.x = x;
ptrItemEntity->position.y = y;
ptrItemEntity->position.z = z;
@ -320,17 +320,17 @@ s32 SetItemPos(script_context* script, s32 initialCall) {
INCLUDE_ASM(code_fa4c0_len_3bf0, SetItemFlags);
s32 AddCoin(script_context* script, s32 initialCall) {
s32 AddCoin(Script* script, s32 initialCall) {
script->varTable[0] = add_coins(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 AddStarPoints(script_context* script, s32 initialCall) {
s32 AddStarPoints(Script* script, s32 initialCall) {
script->varTable[0] = add_star_points(get_variable(script, *script->ptrReadPos));
return 2;
}
s32 AddStarPieces(script_context* script, s32 initialCall) {
s32 AddStarPieces(Script* script, s32 initialCall) {
script->varTable[0] = add_star_pieces(get_variable(script, *script->ptrReadPos));
return 2;
}

View File

@ -2,7 +2,7 @@
INCLUDE_ASM(code_fe0b0_len_5a0, SetSpriteShading);
s32 EnableSpriteShading(script_context* script) {
s32 EnableSpriteShading(Script* script) {
if (get_variable(script, *script->ptrReadPos) != 0) {
*D_80151328 |= 1;
} else {
@ -11,27 +11,27 @@ s32 EnableSpriteShading(script_context* script) {
return 2;
}
s32 getDemoState(script_context* script) {
s32 getDemoState(Script* script) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->demoState);
return 2;
}
s32 DemoPressButton(script_context* script) {
s32 DemoPressButton(Script* script) {
(*gGameStatusPtr)->demoButtonInput |= get_variable(script, *script->ptrReadPos);
return 2;
}
s32 DemoReleaseButton(script_context* script) {
s32 DemoReleaseButton(Script* script) {
(*gGameStatusPtr)->demoButtonInput &= ~get_variable(script, *script->ptrReadPos);
return 2;
}
s32 DemoSetButtons(script_context* script) {
s32 DemoSetButtons(Script* script) {
(*gGameStatusPtr)->demoButtonInput = get_variable(script, *script->ptrReadPos);
return 2;
}
s32 DemoJoystickRadial(script_context* script) {
s32 DemoJoystickRadial(Script* script) {
f32 a;
f32 b;
s32* thisPos = script->ptrReadPos;
@ -45,7 +45,7 @@ s32 DemoJoystickRadial(script_context* script) {
return 2;
}
s32 DemoJoystickXY(script_context* script) {
s32 DemoJoystickXY(Script* script) {
f32 x;
f32 y;
s32* thisPos = script->ptrReadPos;