mirror of
https://github.com/pmret/papermario.git
synced 2024-09-19 16:01:48 +02:00
use partners.h
This commit is contained in:
parent
64dbc07d56
commit
fb1bb896a5
4
Makefile
4
Makefile
@ -161,12 +161,12 @@ $(BUILD_DIR)/%.Yay0.o: $(BUILD_DIR)/%.bin.Yay0
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
# Compile C files
|
||||
$(BUILD_DIR)/%.c.o: %.c $(MDEPS) $(GENERATED_HEADERS)
|
||||
$(BUILD_DIR)/%.c.o: %.c $(MDEPS) $(GENERATED_HEADERS) | $(GENERATED_HEADERS)
|
||||
@mkdir -p $(shell dirname $@)
|
||||
$(CPP) $(CPPFLAGS) -o - $(CPPMFLAGS) $< | $(ICONV) | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
|
||||
# Compile C files (with DSL macros)
|
||||
$(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c $(MDEPS) tools/compile_dsl_macros.py $(GENERATED_HEADERS)
|
||||
$(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c $(MDEPS) tools/compile_dsl_macros.py $(GENERATED_HEADERS) | $(GENERATED_HEADERS)
|
||||
@mkdir -p $(shell dirname $@)
|
||||
$(CPP) $(CPPFLAGS) -o - $< $(CPPMFLAGS) | $(PYTHON) tools/compile_dsl_macros.py | $(ICONV) | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
|
||||
|
@ -11,20 +11,6 @@ typedef UNK_TYPE EncounterTriggerFlags;
|
||||
#define EncounterTriggerFlags_HAMMER 0x00000004
|
||||
#define EncounterTriggerFlags_PARTNER 0x00000006
|
||||
|
||||
typedef s8 PartnerId;
|
||||
#define PartnerId_NONE 0x00
|
||||
#define PartnerId_GOOMBARIO 0x01
|
||||
#define PartnerId_KOOPER 0x02
|
||||
#define PartnerId_BOMBETTE 0x03
|
||||
#define PartnerId_PARAKARRY 0x04
|
||||
#define PartnerId_GOOMPA 0x05
|
||||
#define PartnerId_WATT 0x06
|
||||
#define PartnerId_SUSHIE 0x07
|
||||
#define PartnerId_LAKILESTER 0x08
|
||||
#define PartnerId_BOW 0x09
|
||||
#define PartnerId_GOOMBARIA 0x0A
|
||||
#define PartnerId_TWINK 0x0B
|
||||
|
||||
typedef s32 SongID;
|
||||
#define Song_TOAD_TOWN 0x00000000
|
||||
#define Song_NORMAL_BATTLE 0x00000002
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "world/partners.h"
|
||||
|
||||
void func_800E26B0(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
@ -91,7 +92,7 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E4F10);
|
||||
|
||||
INCLUDE_ASM(s32, "code_7bb60_len_41b0", check_input_midair_jump);
|
||||
|
||||
PartnerId get_current_partner_id(void) {
|
||||
PartnerID get_current_partner_id(void) {
|
||||
return gPlayerData.currentPartner;
|
||||
}
|
||||
|
||||
@ -159,7 +160,7 @@ void set_action_state(s32 actionState) {
|
||||
|
||||
// Whilst Lakilester, Bow, or Parakarry's ability is active, hazards have no effect.
|
||||
partner = playerData->currentPartner;
|
||||
if (((u8)(partner - 7) < 2) || (playerData->currentPartner == PartnerId_PARAKARRY)) {
|
||||
if (((u8)(partner - 7) < 2) || (playerData->currentPartner == PartnerID_PARAKARRY)) {
|
||||
if (D_8010EBB0[0]) {
|
||||
playerStatus->animFlags |= 0x4;
|
||||
playerStatus->flags |= 0x800;
|
||||
@ -247,7 +248,7 @@ s32 check_input_hammer(void) {
|
||||
|
||||
if (playerStatus->pressedButtons & Button_B) {
|
||||
if (!(playerStatus->flags & 4)) {
|
||||
if (D_8010EBB0[0] != 1 || playerData->currentPartner != PartnerId_WATT) {
|
||||
if (D_8010EBB0[0] != 1 || playerData->currentPartner != PartnerID_WATT) {
|
||||
if (playerData->hammerLevel != -1) {
|
||||
set_action_state(ActionState_HAMMER);
|
||||
return TRUE;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "kmr_03.h"
|
||||
#include "../../partners.h"
|
||||
|
||||
Script M(Main);
|
||||
|
||||
@ -6,11 +7,11 @@ ApiStatus func_80240000_8C7F90(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
PlayerData* playerData = PLAYER_DATA;
|
||||
NpcId npcID = get_variable(script, *args++);
|
||||
PartnerId partnerID = get_variable(script, *args++);
|
||||
PartnerID partnerID = get_variable(script, *args++);
|
||||
Npc* npc = get_npc_safe(npcID);
|
||||
|
||||
if (isInitialCall) {
|
||||
if (gPlayerData.currentPartner == PartnerId_NONE) {
|
||||
if (gPlayerData.currentPartner == PartnerID_NONE) {
|
||||
script->functionTemp[0].s = 2;
|
||||
} else {
|
||||
script->functionTemp[0].s = 0;
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "common.h"
|
||||
#include "../partners.h"
|
||||
|
||||
static ApiStatus PartnerSuspendAbilityScript(ScriptInstance* script, s32 isInitialCall) {
|
||||
if (gPlayerData.currentPartner == PartnerId_NONE) {
|
||||
if (gPlayerData.currentPartner == PartnerID_NONE) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
partner_suspend_ability_script();
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "../partners.h"
|
||||
|
||||
void func_802BD100_324F10(Npc* npc) {
|
||||
npc->collisionHeight = 24;
|
||||
@ -24,7 +25,7 @@ ApiStatus func_802BD14C_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
func_800EBA3C(owner);
|
||||
func_800EBB40(owner);
|
||||
playerData->unk_2F4[PartnerId_GOOMBARIA]++;
|
||||
playerData->unk_2F4[PartnerID_GOOMBARIA]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "../partners.h"
|
||||
|
||||
// Init
|
||||
void func_802BD100_325070(Npc* npc) {
|
||||
@ -25,7 +26,7 @@ ApiStatus func_802BD148_325070(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
update_player_move_history(owner);
|
||||
func_800ED5D0(owner);
|
||||
playerData->unk_2F4[PartnerId_TWINK]++;
|
||||
playerData->unk_2F4[PartnerID_TWINK]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "ld_addrs.h"
|
||||
#include "partners.h"
|
||||
|
||||
#include "partner/goombario.h"
|
||||
#include "sprite/npc/world_goombario.h"
|
||||
@ -25,28 +26,10 @@
|
||||
|
||||
#include "sprite/npc/twink.h"
|
||||
|
||||
typedef struct WorldPartner {
|
||||
/* 0x00 */ void* dmaStart;
|
||||
/* 0x04 */ void* dmaEnd;
|
||||
/* 0x08 */ void* dmaDest; ///< Always `0x802BD100`
|
||||
/* 0x10 */ s32 isFlying;
|
||||
/* 0x14 */ void (*init)(Npc* partner);
|
||||
/* 0x18 */ Bytecode* takeOut;
|
||||
/* 0x1C */ Bytecode* useAbility;
|
||||
/* 0x20 */ Bytecode* update;
|
||||
/* 0x24 */ Bytecode* putAway;
|
||||
/* 0x28 */ NpcAnimID idle;
|
||||
/* 0x2C */ UNK_FUN_PTR(testFirstStrike);
|
||||
/* 0x30 */ UNK_FUN_PTR(canUseAbility);
|
||||
/* 0x34 */ UNK_FUN_PTR(canPlayerPause);
|
||||
/* 0x38 */ void (*preBattle)(Npc* partner);
|
||||
/* 0x3C */ UNK_FUN_PTR(postBattle);
|
||||
/* 0x40 */ Bytecode* whileRiding;
|
||||
} WorldPartner; // size = 0x40
|
||||
|
||||
static s32 _pad[] = { 0x00, 0x00, 0x00 };
|
||||
|
||||
WorldPartner gWorldPartners[] = {
|
||||
// XXX: it's possible that's there's a "none" entry here to match up with enum PartnerID
|
||||
{
|
||||
// Goombario
|
||||
.dmaStart = &world_partner_goombario_ROM_START,
|
||||
|
43
src/world/partners.h
Normal file
43
src/world/partners.h
Normal file
@ -0,0 +1,43 @@
|
||||
#ifndef _WORLD_PARTNERS_H
|
||||
#define _WORLD_PARTNERS_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct WorldPartner {
|
||||
/* 0x00 */ void* dmaStart;
|
||||
/* 0x04 */ void* dmaEnd;
|
||||
/* 0x08 */ void* dmaDest; ///< Always `0x802BD100`
|
||||
/* 0x10 */ s32 isFlying;
|
||||
/* 0x14 */ void (*init)(Npc* partner);
|
||||
/* 0x18 */ Bytecode* takeOut;
|
||||
/* 0x1C */ Bytecode* useAbility;
|
||||
/* 0x20 */ Bytecode* update;
|
||||
/* 0x24 */ Bytecode* putAway;
|
||||
/* 0x28 */ NpcAnimID idle;
|
||||
/* 0x2C */ UNK_FUN_PTR(testFirstStrike);
|
||||
/* 0x30 */ UNK_FUN_PTR(canUseAbility);
|
||||
/* 0x34 */ UNK_FUN_PTR(canPlayerPause);
|
||||
/* 0x38 */ void (*preBattle)(Npc* partner);
|
||||
/* 0x3C */ UNK_FUN_PTR(postBattle);
|
||||
/* 0x40 */ Bytecode* whileRiding;
|
||||
} WorldPartner; // size = 0x40
|
||||
|
||||
WorldPartner gWorldPartners[11];
|
||||
|
||||
typedef s8 PartnerID;
|
||||
enum PartnerID {
|
||||
PartnerID_NONE,
|
||||
PartnerID_GOOMBARIO,
|
||||
PartnerID_KOOPER,
|
||||
PartnerID_BOMBETTE,
|
||||
PartnerID_PARAKARRY,
|
||||
PartnerID_GOOMPA,
|
||||
PartnerID_WATT,
|
||||
PartnerID_SUSHIE,
|
||||
PartnerID_LAKILESTER,
|
||||
PartnerID_BOW,
|
||||
PartnerID_GOOMBARIA,
|
||||
PartnerID_TWINK,
|
||||
};
|
||||
|
||||
#endif
|
@ -1,4 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "../partners.h"
|
||||
|
||||
ApiStatus func_80282880(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = PLAYER_STATUS;
|
||||
@ -62,7 +63,7 @@ ApiStatus TeleportPartnerToPlayer(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus2 = PLAYER_STATUS;
|
||||
Npc* partner;
|
||||
|
||||
if (PLAYER_DATA->currentPartner == PartnerId_NONE) {
|
||||
if (PLAYER_DATA->currentPartner == PartnerID_NONE) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -91,7 +92,7 @@ ApiStatus func_80283908(ScriptInstance* script, s32 isInitialCall) {
|
||||
playerStatus->position.y = GAME_STATUS->savedPos.y;
|
||||
playerStatus->position.z = GAME_STATUS->savedPos.z;
|
||||
|
||||
if (currentPartner != PartnerId_NONE) {
|
||||
if (currentPartner != PartnerID_NONE) {
|
||||
Npc* partner = get_npc_unsafe(NpcId_PARTNER);
|
||||
f32 angle = clamp_angle((playerStatus2->spriteFacingAngle < 180.0f) ? (90.0f) : (-90.0f));
|
||||
partner->pos.x = playerStatus2->position.x;
|
||||
|
@ -1,43 +0,0 @@
|
||||
#include "common.h"
|
||||
|
||||
void func_802BD100_324F10(Npc* npc) {
|
||||
npc->collisionHeight = 24;
|
||||
npc->collisionRadius = 20;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD114_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD14C_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
enable_partner_walking(owner, TRUE);
|
||||
}
|
||||
|
||||
func_800EBA3C(owner);
|
||||
func_800EBB40(owner);
|
||||
playerData->unk_2F4[PartnerId_GOOMBARIA]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1AC_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1B4(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#include "common.h"
|
||||
|
||||
void func_802BD100_324A10(Npc* npc) {
|
||||
npc->collisionHeight = 24;
|
||||
npc->collisionRadius = 20;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD114(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "world_goompa", func_802BD14C);
|
||||
|
||||
INCLUDE_ASM(s32, "world_goompa", func_802BD4E0);
|
||||
|
||||
ApiStatus func_802BD524(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD52C(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
#include "common.h"
|
||||
|
||||
// Init
|
||||
void func_802BD100_325070(Npc* npc) {
|
||||
npc->collisionHeight = 20;
|
||||
npc->collisionRadius = 20;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD110(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD148_325070(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
enable_partner_flying(owner, TRUE);
|
||||
}
|
||||
|
||||
update_player_move_history(owner);
|
||||
func_800ED5D0(owner);
|
||||
playerData->unk_2F4[PartnerId_TWINK]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1A8(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1B0(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user