mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
Merge branch 'master' of github.com:ethteck/PaperMarioDecompilation
This commit is contained in:
commit
57e77e1cb1
@ -1,41 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
.include "include/macro.inc"
|
||||
|
||||
glabel sort_items
|
||||
/* 080B7C 800E76CC 24060008 */ addiu $a2, $zero, 8
|
||||
/* 080B80 800E76D0 3C088011 */ lui $t0, 0x8011
|
||||
/* 080B84 800E76D4 2508F290 */ addiu $t0, $t0, -0xd70
|
||||
/* 080B88 800E76D8 25070010 */ addiu $a3, $t0, 0x10
|
||||
.L800E76DC:
|
||||
/* 080B8C 800E76DC 84E201B4 */ lh $v0, 0x1b4($a3)
|
||||
/* 080B90 800E76E0 50400012 */ beql $v0, $zero, .L800E772C
|
||||
/* 080B94 800E76E4 24C6FFFF */ addiu $a2, $a2, -1
|
||||
/* 080B98 800E76E8 24040009 */ addiu $a0, $zero, 9
|
||||
/* 080B9C 800E76EC 00C4102A */ slt $v0, $a2, $a0
|
||||
/* 080BA0 800E76F0 5040000E */ beql $v0, $zero, .L800E772C
|
||||
/* 080BA4 800E76F4 24C6FFFF */ addiu $a2, $a2, -1
|
||||
/* 080BA8 800E76F8 00E0282D */ daddu $a1, $a3, $zero
|
||||
/* 080BAC 800E76FC 25030012 */ addiu $v1, $t0, 0x12
|
||||
.L800E7700:
|
||||
/* 080BB0 800E7700 846201B4 */ lh $v0, 0x1b4($v1)
|
||||
/* 080BB4 800E7704 54400005 */ bnezl $v0, .L800E771C
|
||||
/* 080BB8 800E7708 2484FFFF */ addiu $a0, $a0, -1
|
||||
/* 080BBC 800E770C 94A201B4 */ lhu $v0, 0x1b4($a1)
|
||||
/* 080BC0 800E7710 A46201B4 */ sh $v0, 0x1b4($v1)
|
||||
/* 080BC4 800E7714 08039DCA */ j .L800E7728
|
||||
/* 080BC8 800E7718 A4A001B4 */ sh $zero, 0x1b4($a1)
|
||||
|
||||
.L800E771C:
|
||||
/* 080BCC 800E771C 00C4102A */ slt $v0, $a2, $a0
|
||||
/* 080BD0 800E7720 1440FFF7 */ bnez $v0, .L800E7700
|
||||
/* 080BD4 800E7724 2463FFFE */ addiu $v1, $v1, -2
|
||||
.L800E7728:
|
||||
/* 080BD8 800E7728 24C6FFFF */ addiu $a2, $a2, -1
|
||||
.L800E772C:
|
||||
/* 080BDC 800E772C 04C1FFEB */ bgez $a2, .L800E76DC
|
||||
/* 080BE0 800E7730 24E7FFFE */ addiu $a3, $a3, -2
|
||||
/* 080BE4 800E7734 03E00008 */ jr $ra
|
||||
/* 080BE8 800E7738 00000000 */ nop
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define _MACROS_H_
|
||||
|
||||
#define INCLUDE_ASM(FOLDER, NAME, ARGS...) \
|
||||
__attribute__((naked)) NAME(ARGS) { __asm__( ".include \"asm/nonmatchings/"#FOLDER"/"#NAME".s\"\n.set reorder"); }
|
||||
__attribute__((naked)) NAME(ARGS) { __asm__( ".include \"asm/nonmatchings/"#FOLDER"/"#NAME".s\"\n.set reorder\n.set at"); }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
void sort_items(void);
|
||||
|
||||
void clear_player_data(void) {
|
||||
player_data* playerData = &gPlayerData;
|
||||
s32 i;
|
||||
@ -169,7 +171,25 @@ s32 find_item(s32 itemID) {
|
||||
return i;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_80850_len_3060, sort_items);
|
||||
void sort_items(void)
|
||||
{
|
||||
player_data* playerData = &gPlayerData;
|
||||
int j;
|
||||
int i;
|
||||
|
||||
for (i = ARRAY_COUNT(playerData->invItems) - 2; i >= 0; i--) {
|
||||
if (playerData->invItems[i] != 0) {
|
||||
for (j = ARRAY_COUNT(playerData->invItems) - 1; i < j; j--) {
|
||||
if (playerData->invItems[j] == 0) {
|
||||
playerData->invItems[j] = playerData->invItems[i];
|
||||
playerData->invItems[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
s32 add_badge(s32 itemID) {
|
||||
player_data* playerData = &gPlayerData;
|
||||
|
Loading…
Reference in New Issue
Block a user