Skip to content

Commit

Permalink
Merge pull request #277 from DizzyEggg/GROUND_SCRIPT_INCOMPLETE_DECLA…
Browse files Browse the repository at this point in the history
…RATIONS

remove GROUND_SCRIPT_INCOMPLETE_DECLARATIONS
  • Loading branch information
SethBarberee authored Nov 29, 2024
2 parents 2d4127b + 86c2479 commit 34c4821
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
5 changes: 0 additions & 5 deletions include/code_80A26CC.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ void sub_80A2558(s32, s16 *);
void sub_80A2584(s16, s16);
void sub_80A2598(s16, s16);
u32 sub_80A25AC(u16);
#if !defined(NONMATCHING) && defined(GROUND_SCRIPT_INCOMPLETE_DECLARATIONS)
// Workaround for ExecuteScriptCommand relying on s32 behavior of arguments
const DungeonInfo *GetDungeonInfo_80A2608(s32 index);
#else
const DungeonInfo *GetDungeonInfo_80A2608(s16 index);
#endif
const DungeonInfo *sub_80A2620(s16 index);
s16 sub_80A2654(s16 index);
s16 sub_80A2668(u32);
Expand Down
9 changes: 0 additions & 9 deletions include/ground_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,8 @@ typedef struct GroundConversionStruct
bool8 sub_8098F88(void);
const char *sub_8098FB4(void);

#if !defined(NONMATCHING) && defined(GROUND_SCRIPT_INCOMPLETE_DECLARATIONS)
// Workaround for ExecuteScriptCommand relying on s32 behavior of arguments
// Arguments could be left fully implicit (as I think they were in the original code),
// but this way at least verifies the argument count
bool8 GroundMainGroundRequest(s32 r0, s32 r1, s32 r2);
bool8 GroundMainRescueRequest(s32 r0, s32 r1);
#else
bool8 GroundMainGroundRequest(s16 r0, u32 r1, s32 r2);
bool8 GroundMainRescueRequest(s16 r0, u32 r1);
#endif

bool32 GroundMainGameEndRequest(u32 r0);
bool32 GroundMainGameCancelRequest(u32 r0);
bool8 sub_8098D80(u32 speed);
Expand Down
5 changes: 3 additions & 2 deletions src/code_80A26CC.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ u32 sub_80A25AC(u16 param_1)
return 1;
}

const DungeonInfo *GetDungeonInfo_80A2608(s16 index)
const DungeonInfo *GetDungeonInfo_80A2608(s32 _index)
{
s32 index = (s16) _index;
return &gUnknown_81168A8[index];
}

Expand Down Expand Up @@ -186,7 +187,7 @@ u8 sub_80A2740(s32 index)
{
const DungeonInfo *temp;

temp = GetDungeonInfo_80A2608(index);
temp = GetDungeonInfo_80A2608((s16) index);
return temp->dungeonIndex;
}

Expand Down
10 changes: 5 additions & 5 deletions src/ground_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ void sub_8098CC8(void)
ClearAllItems_8091FB4();
}

bool8 GroundMainGroundRequest(s16 r0, u32 r1, s32 r2)
bool8 GroundMainGroundRequest(s32 r0, s32 r1, s32 r2)
{
s32 temp;
temp = r0; // force a asr shift
s32 temp = (s16) r0; // force a asr shift
if(gUnknown_20398A8 == 0)
{
Log(0, sFmtGroundRequest, temp, r2);
Expand Down Expand Up @@ -191,9 +190,10 @@ bool8 sub_8098DCC(u32 speed)
return FALSE;
}

bool8 GroundMainRescueRequest(s16 r0, u32 r1)
bool8 GroundMainRescueRequest(s32 r0, s32 r1)
{
s32 r2 = r0, r5 = r2;
s32 r2 = (s16) r0;
s32 r5 = r2;
if(gUnknown_20398A8 == 0)
{
Log(0, sFmtRescueRequest, r2, r1);
Expand Down
9 changes: 2 additions & 7 deletions src/ground_script_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
#include "exclusive_pokemon.h"
#include "items.h"
#include "math.h"

#ifndef NONMATCHING
#define GROUND_SCRIPT_INCOMPLETE_DECLARATIONS
#endif

#include "ground_main.h"
#include "code_80A26CC.h"

Expand Down Expand Up @@ -1838,10 +1833,10 @@ s32 ExecuteScriptCommand(Action *action) {

UNUSED u32 sub_80A1440(u32 r0, u32 r1, u32 r2)
{
return sub_80A14E8(0, r0, r1, r2);
return sub_80A14E8(0, r0, r1, r2);
}

UNUSED bool8 GroundScript_ExecuteTrigger(s16 r0)
UNUSED bool8 GroundScript_ExecuteTrigger(s16 r0)
{
s32 ret;
ScriptInfoSmall scriptInfo;
Expand Down

0 comments on commit 34c4821

Please sign in to comment.