mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
more
This commit is contained in:
parent
fc1361c4b8
commit
a9e5d79531
@ -1,34 +1,7 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
|
||||
glabel save_game_at_player_position
|
||||
/* 102A20 802E11A0 3C04800F */ lui $a0, 0x800f
|
||||
/* 102A24 802E11A4 8C847B30 */ lw $a0, 0x7b30($a0)
|
||||
/* 102A28 802E11A8 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 102A2C 802E11AC AFBF0010 */ sw $ra, 0x10($sp)
|
||||
/* 102A30 802E11B0 C4800028 */ lwc1 $f0, 0x28($a0)
|
||||
/* 102A34 802E11B4 3C038007 */ lui $v1, 0x8007
|
||||
/* 102A38 802E11B8 8C63419C */ lw $v1, 0x419c($v1)
|
||||
/* 102A3C 802E11BC 4600008D */ trunc.w.s $f2, $f0
|
||||
/* 102A40 802E11C0 44021000 */ mfc1 $v0, $f2
|
||||
/* 102A44 802E11C4 00000000 */ nop
|
||||
/* 102A48 802E11C8 A4620160 */ sh $v0, 0x160($v1)
|
||||
/* 102A4C 802E11CC C480002C */ lwc1 $f0, 0x2c($a0)
|
||||
/* 102A50 802E11D0 4600008D */ trunc.w.s $f2, $f0
|
||||
/* 102A54 802E11D4 44021000 */ mfc1 $v0, $f2
|
||||
/* 102A58 802E11D8 00000000 */ nop
|
||||
/* 102A5C 802E11DC A4620162 */ sh $v0, 0x162($v1)
|
||||
/* 102A60 802E11E0 C4800030 */ lwc1 $f0, 0x30($a0)
|
||||
/* 102A64 802E11E4 90640166 */ lbu $a0, 0x166($v1)
|
||||
/* 102A68 802E11E8 4600008D */ trunc.w.s $f2, $f0
|
||||
/* 102A6C 802E11EC 44021000 */ mfc1 $v0, $f2
|
||||
/* 102A70 802E11F0 0C00ACDD */ jal fio_save_game
|
||||
/* 102A74 802E11F4 A4620164 */ sh $v0, 0x164($v1)
|
||||
/* 102A78 802E11F8 8FBF0010 */ lw $ra, 0x10($sp)
|
||||
/* 102A7C 802E11FC 03E00008 */ jr $ra
|
||||
/* 102A80 802E1200 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
|
||||
glabel func_802E1204
|
||||
/* 102A84 802E1204 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 102A88 802E1208 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 102A8C 802E120C 0080802D */ daddu $s0, $a0, $zero
|
||||
@ -261,4 +234,3 @@ glabel save_game_at_player_position
|
||||
/* 102DB0 802E1530 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 102DB4 802E1534 03E00008 */ jr $ra
|
||||
/* 102DB8 802E1538 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
|
@ -264,7 +264,9 @@ typedef struct ScriptInstance {
|
||||
|
||||
typedef struct Entity {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ char unk_04[7];
|
||||
/* 0x04 */ char unk_04[2];
|
||||
/* 0x06 */ s8 unk_06;
|
||||
/* 0x07 */ char unk_08[4];
|
||||
/* 0x0B */ u8 alpha; /* reported by rain */
|
||||
/* 0x0C */ s16 aabb[3];
|
||||
/* 0x12 */ char unk_12[4];
|
||||
@ -896,7 +898,7 @@ typedef struct GameStatus {
|
||||
/* 0x15C */ s16 unk_15C;
|
||||
/* 0x15E */ char unk_15E[0x2];
|
||||
/* 0x160 */ s16 savedPos[3];
|
||||
/* 0x166 */ s8 saveSlot;
|
||||
/* 0x166 */ u8 saveSlot;
|
||||
/* 0x167 */ u8 loadType; /* (0 = from map, 1 = from main menu) */
|
||||
/* 0x168 */ s32 saveCount;
|
||||
/* 0x16C */ char unk_16C[12];
|
||||
|
@ -10,9 +10,9 @@ void osCleanupThread(void);
|
||||
s32 heap_malloc(s32 size);
|
||||
HeapNode* _heap_create(void* addr, s32 size);
|
||||
|
||||
s8 get_global_byte(s32 index);
|
||||
s32 get_global_byte(s32 index);
|
||||
s32 get_global_flag(s32 index);
|
||||
s8 get_area_byte(s32 index);
|
||||
s32 get_area_byte(s32 index);
|
||||
s32 get_area_flag(s32 index);
|
||||
|
||||
void clone_model(u16 srcModelID, u16 newModelID);
|
||||
|
@ -11,6 +11,7 @@ extern PlayerData gPlayerData;
|
||||
extern ActionState gPlayerActionState;
|
||||
extern PlayerAnim gPlayerAnimation;
|
||||
extern PlayerStatus gPlayerStatus;
|
||||
extern PlayerStatus* gPlayerStatusPtr;
|
||||
extern GameStatus* gGameStatusPtr[1];
|
||||
extern s32 gRandSeed;
|
||||
extern StaticItem gItemTable[364];
|
||||
|
@ -1,12 +1,27 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", func_802E0D90);
|
||||
// Needs rodata support, is above func
|
||||
/*void create_shadow_callback(Shadow* shadow) {
|
||||
shadow->scale.x = 0.1f;
|
||||
shadow->scale.y = 0.1f;
|
||||
shadow->scale.z = 0.1f;
|
||||
}*/
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", func_802E0DB0);
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", func_802E0DE0);
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", save_game_at_player_position);
|
||||
void save_game_at_player_position(void) {
|
||||
GameStatus* gameStatus = GAME_STATUS;
|
||||
|
||||
gameStatus->savedPos[0] = gPlayerStatusPtr->position.x;
|
||||
gameStatus->savedPos[1] = gPlayerStatusPtr->position.y;
|
||||
gameStatus->savedPos[2] = gPlayerStatusPtr->position.z;
|
||||
fio_save_game(gameStatus->saveSlot);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", func_802E1204);
|
||||
|
||||
INCLUDE_ASM("code_102610_len_2330", func_802E153C);
|
||||
|
||||
|
@ -121,7 +121,7 @@ s8 set_global_byte(s32 index, s8 value) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s8 get_global_byte(s32 index) {
|
||||
s32 get_global_byte(s32 index) {
|
||||
return gCurrentSaveFile.globalBytes[index];
|
||||
}
|
||||
|
||||
@ -173,6 +173,6 @@ s8 set_area_byte(s32 index, s8 value) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s8 get_area_byte(s32 index) {
|
||||
s32 get_area_byte(s32 index) {
|
||||
return gCurrentSaveFile.areaBytes[index];
|
||||
}
|
||||
|
@ -721,51 +721,54 @@ INCLUDE_ASM("code_e92d0_len_5da0", si_execute_next_command);
|
||||
// TODO: consider renaming to si_get_variable
|
||||
#ifdef NON_MATCHING
|
||||
s32 get_variable(ScriptInstance* script, Bytecode var) {
|
||||
s32 abs_value;
|
||||
s32 word_index;
|
||||
s32 bit_index;
|
||||
s32 wordIdx;
|
||||
s32 bitIdx;
|
||||
|
||||
if (var <= -270000000) {
|
||||
return var;
|
||||
} else if (var <= -250000000) {
|
||||
return var;
|
||||
} else if (var <= -220000000) {
|
||||
return (s32) fixed_var_to_float(var);
|
||||
return fixed_var_to_float(var);
|
||||
} else if (var <= -200000000) {
|
||||
var += 210000000;
|
||||
word_index = var / 32;
|
||||
bit_index = var % 32;
|
||||
return (script->flagArray[word_index] & (1 << bit_index)) != 0;
|
||||
wordIdx = var / 32;
|
||||
bitIdx = var % 32;
|
||||
return (script->flagArray[wordIdx] & (1 << bitIdx)) != 0;
|
||||
} else if (var <= -180000000) {
|
||||
var += 190000000;
|
||||
var = script->array[var];
|
||||
return (var > -270000000 && var < -220000000) ? (s32) fixed_var_to_float(var) : var;
|
||||
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
||||
} else if (var <= -160000000) {
|
||||
return get_global_byte(var + 170000000);
|
||||
var += 170000000;
|
||||
return get_global_byte(var);
|
||||
} else if (var <= -140000000) {
|
||||
return get_area_byte(var + 150000000);
|
||||
var += 150000000;
|
||||
return get_area_byte(var);
|
||||
} else if (var <= -120000000) {
|
||||
return get_global_flag(var + 130000000);
|
||||
var += 130000000;
|
||||
return get_global_flag(var);
|
||||
} else if (var <= -100000000) {
|
||||
return get_area_flag(var + 110000000);
|
||||
var += 110000000;
|
||||
return get_area_flag(var);
|
||||
} else if (var <= -80000000) {
|
||||
s32 avar = var + 90000000;
|
||||
word_index = avar / 32;
|
||||
bit_index = avar % 32;
|
||||
return (gMapFlags[word_index] & (1 << bit_index)) != 0;
|
||||
var += 90000000;
|
||||
wordIdx = var / 32;
|
||||
bitIdx = var % 32;
|
||||
return (gMapFlags[wordIdx] & (1 << bitIdx)) != 0;
|
||||
} else if (var <= -60000000) {
|
||||
var += 70000000;
|
||||
word_index = var / 32;
|
||||
bit_index = var % 32;
|
||||
return (script->varFlags[word_index] & (1 << bit_index)) != 0;
|
||||
wordIdx = var / 32;
|
||||
bitIdx = var % 32;
|
||||
return (script->varFlags[wordIdx] & (1 << bitIdx)) != 0;
|
||||
} else if (var <= -40000000) {
|
||||
var += 50000000;
|
||||
var = gMapVars[var];
|
||||
return (var > -270000000 && var < -220000000) ? (s32) fixed_var_to_float(var) : var;
|
||||
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
||||
} else if (var <= -20000000) {
|
||||
var += 30000000;
|
||||
var = script->varTable[var];
|
||||
return (var > -270000000 && var < -220000000) ? (s32) fixed_var_to_float(var) : var;
|
||||
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
||||
} else {
|
||||
return var;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
name: "Paper Mario (North America)"
|
||||
basename: "papermario"
|
||||
options: ["skip-asm"]
|
||||
compiler: "GCC"
|
||||
segments:
|
||||
- name: header
|
||||
type: code
|
||||
|
@ -4,6 +4,7 @@ gUIStatus = 0x8010EF58;
|
||||
gPlayerData = 0x8010F290;
|
||||
gPlayerActionState = 0x8010F07C;
|
||||
gPlayerAnimation = 0x8010F080;
|
||||
gPlayerStatusPtr = 0x800F7B30;
|
||||
gPlayerStatus = 0x8010EFC8;
|
||||
gItemTable = 0x800878E0;
|
||||
gWorldScriptList = 0x802DA490;
|
||||
|
Loading…
Reference in New Issue
Block a user