fix bug in assembler

This commit is contained in:
dark-samus 2020-08-14 21:54:11 -04:00
commit 50f8ca824b
21 changed files with 197 additions and 334 deletions

View File

@ -1,42 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel load_map_bg
/* 0DC470 80145D70 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0DC474 80145D74 AFBF001C */ sw $ra, 0x1c($sp)
/* 0DC478 80145D78 1080001B */ beqz $a0, .L80145DE8
/* 0DC47C 80145D7C AFB00018 */ sw $s0, 0x18($sp)
/* 0DC480 80145D80 0080802D */ daddu $s0, $a0, $zero
/* 0DC484 80145D84 0000202D */ daddu $a0, $zero, $zero
/* 0DC488 80145D88 3C05F5DE */ lui $a1, 0xf5de
/* 0DC48C 80145D8C 0C0B1EAF */ jal get_variable
/* 0DC490 80145D90 34A50180 */ ori $a1, $a1, 0x180
/* 0DC494 80145D94 28420035 */ slti $v0, $v0, 0x35
/* 0DC498 80145D98 1440000A */ bnez $v0, .L80145DC4
/* 0DC49C 80145D9C 0200202D */ daddu $a0, $s0, $zero
/* 0DC4A0 80145DA0 3C058015 */ lui $a1, 0x8015
/* 0DC4A4 80145DA4 24A5F120 */ addiu $a1, $a1, -0xee0
/* 0DC4A8 80145DA8 0C01BB5C */ jal strcmp
/* 0DC4AC 80145DAC 0200202D */ daddu $a0, $s0, $zero
/* 0DC4B0 80145DB0 54400004 */ bnel $v0, $zero, .L80145DC4
/* 0DC4B4 80145DB4 0200202D */ daddu $a0, $s0, $zero
/* 0DC4B8 80145DB8 3C108015 */ lui $s0, 0x8015
/* 0DC4BC 80145DBC 2610F128 */ addiu $s0, $s0, -0xed8
/* 0DC4C0 80145DC0 0200202D */ daddu $a0, $s0, $zero
.L80145DC4:
/* 0DC4C4 80145DC4 0C016B3A */ jal load_asset_by_name
/* 0DC4C8 80145DC8 27A50010 */ addiu $a1, $sp, 0x10
/* 0DC4CC 80145DCC 0040802D */ daddu $s0, $v0, $zero
/* 0DC4D0 80145DD0 3C058020 */ lui $a1, 0x8020
/* 0DC4D4 80145DD4 24A50000 */ addiu $a1, $a1, 0
/* 0DC4D8 80145DD8 0C01BB7C */ jal decode_yay0
/* 0DC4DC 80145DDC 0200202D */ daddu $a0, $s0, $zero
/* 0DC4E0 80145DE0 0C00AB1E */ jal general_heap_free
/* 0DC4E4 80145DE4 0200202D */ daddu $a0, $s0, $zero
.L80145DE8:
/* 0DC4E8 80145DE8 8FBF001C */ lw $ra, 0x1c($sp)
/* 0DC4EC 80145DEC 8FB00018 */ lw $s0, 0x18($sp)
/* 0DC4F0 80145DF0 03E00008 */ jr $ra
/* 0DC4F4 80145DF4 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel does_script_exist
/* 0E8B14 802C4164 0000282D */ daddu $a1, $zero, $zero
/* 0E8B18 802C4168 3C03802E */ lui $v1, 0x802e
/* 0E8B1C 802C416C 8C63A890 */ lw $v1, -0x5770($v1)
.L802C4170:
/* 0E8B20 802C4170 8C620000 */ lw $v0, ($v1)
/* 0E8B24 802C4174 10400006 */ beqz $v0, .L802C4190
/* 0E8B28 802C4178 24A50001 */ addiu $a1, $a1, 1
/* 0E8B2C 802C417C 8C420144 */ lw $v0, 0x144($v0)
/* 0E8B30 802C4180 14440004 */ bne $v0, $a0, .L802C4194
/* 0E8B34 802C4184 28A20080 */ slti $v0, $a1, 0x80
/* 0E8B38 802C4188 03E00008 */ jr $ra
/* 0E8B3C 802C418C 24020001 */ addiu $v0, $zero, 1
.L802C4190:
/* 0E8B40 802C4190 28A20080 */ slti $v0, $a1, 0x80
.L802C4194:
/* 0E8B44 802C4194 1440FFF6 */ bnez $v0, .L802C4170
/* 0E8B48 802C4198 24630004 */ addiu $v1, $v1, 4
/* 0E8B4C 802C419C 03E00008 */ jr $ra
/* 0E8B50 802C41A0 0000102D */ daddu $v0, $zero, $zero

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel get_script_by_id
/* 0E9158 802C47A8 0000302D */ daddu $a2, $zero, $zero
/* 0E915C 802C47AC 3C05802E */ lui $a1, 0x802e
/* 0E9160 802C47B0 8CA5A890 */ lw $a1, -0x5770($a1)
.L802C47B4:
/* 0E9164 802C47B4 8CA30000 */ lw $v1, ($a1)
/* 0E9168 802C47B8 10600006 */ beqz $v1, .L802C47D4
/* 0E916C 802C47BC 24C60001 */ addiu $a2, $a2, 1
/* 0E9170 802C47C0 8C620144 */ lw $v0, 0x144($v1)
/* 0E9174 802C47C4 14440004 */ bne $v0, $a0, .L802C47D8
/* 0E9178 802C47C8 28C20080 */ slti $v0, $a2, 0x80
/* 0E917C 802C47CC 03E00008 */ jr $ra
/* 0E9180 802C47D0 0060102D */ daddu $v0, $v1, $zero
.L802C47D4:
/* 0E9184 802C47D4 28C20080 */ slti $v0, $a2, 0x80
.L802C47D8:
/* 0E9188 802C47D8 1440FFF6 */ bnez $v0, .L802C47B4
/* 0E918C 802C47DC 24A50004 */ addiu $a1, $a1, 4
/* 0E9190 802C47E0 03E00008 */ jr $ra
/* 0E9194 802C47E4 0000102D */ daddu $v0, $zero, $zero

View File

@ -1,12 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel get_script_by_index
/* 0E9140 802C4790 3C02802E */ lui $v0, 0x802e
/* 0E9144 802C4794 8C42A890 */ lw $v0, -0x5770($v0)
/* 0E9148 802C4798 00042080 */ sll $a0, $a0, 2
/* 0E914C 802C479C 00822021 */ addu $a0, $a0, $v0
/* 0E9150 802C47A0 03E00008 */ jr $ra
/* 0E9154 802C47A4 8C820000 */ lw $v0, ($a0)

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel kill_all_scripts
/* 0E8AC4 802C4114 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0E8AC8 802C4118 AFB00010 */ sw $s0, 0x10($sp)
/* 0E8ACC 802C411C 0000802D */ daddu $s0, $zero, $zero
/* 0E8AD0 802C4120 AFBF0014 */ sw $ra, 0x14($sp)
.L802C4124:
/* 0E8AD4 802C4124 3C03802E */ lui $v1, 0x802e
/* 0E8AD8 802C4128 8C63A890 */ lw $v1, -0x5770($v1)
/* 0E8ADC 802C412C 00101080 */ sll $v0, $s0, 2
/* 0E8AE0 802C4130 00431021 */ addu $v0, $v0, $v1
/* 0E8AE4 802C4134 8C440000 */ lw $a0, ($v0)
/* 0E8AE8 802C4138 10800003 */ beqz $a0, .L802C4148
/* 0E8AEC 802C413C 26100001 */ addiu $s0, $s0, 1
/* 0E8AF0 802C4140 0C0B0FCF */ jal kill_script
/* 0E8AF4 802C4144 00000000 */ nop
.L802C4148:
/* 0E8AF8 802C4148 2A020080 */ slti $v0, $s0, 0x80
/* 0E8AFC 802C414C 1440FFF5 */ bnez $v0, .L802C4124
/* 0E8B00 802C4150 00000000 */ nop
/* 0E8B04 802C4154 8FBF0014 */ lw $ra, 0x14($sp)
/* 0E8B08 802C4158 8FB00010 */ lw $s0, 0x10($sp)
/* 0E8B0C 802C415C 03E00008 */ jr $ra
/* 0E8B10 802C4160 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,34 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel kill_script_by_ID
/* 0E8A5C 802C40AC 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0E8A60 802C40B0 AFB10014 */ sw $s1, 0x14($sp)
/* 0E8A64 802C40B4 0080882D */ daddu $s1, $a0, $zero
/* 0E8A68 802C40B8 AFB00010 */ sw $s0, 0x10($sp)
/* 0E8A6C 802C40BC 0000802D */ daddu $s0, $zero, $zero
/* 0E8A70 802C40C0 AFBF0018 */ sw $ra, 0x18($sp)
.L802C40C4:
/* 0E8A74 802C40C4 3C03802E */ lui $v1, 0x802e
/* 0E8A78 802C40C8 8C63A890 */ lw $v1, -0x5770($v1)
/* 0E8A7C 802C40CC 00101080 */ sll $v0, $s0, 2
/* 0E8A80 802C40D0 00431021 */ addu $v0, $v0, $v1
/* 0E8A84 802C40D4 8C440000 */ lw $a0, ($v0)
/* 0E8A88 802C40D8 10800006 */ beqz $a0, .L802C40F4
/* 0E8A8C 802C40DC 26100001 */ addiu $s0, $s0, 1
/* 0E8A90 802C40E0 8C820144 */ lw $v0, 0x144($a0)
/* 0E8A94 802C40E4 14510003 */ bne $v0, $s1, .L802C40F4
/* 0E8A98 802C40E8 00000000 */ nop
/* 0E8A9C 802C40EC 0C0B0FCF */ jal kill_script
/* 0E8AA0 802C40F0 00000000 */ nop
.L802C40F4:
/* 0E8AA4 802C40F4 2A020080 */ slti $v0, $s0, 0x80
/* 0E8AA8 802C40F8 1440FFF2 */ bnez $v0, .L802C40C4
/* 0E8AAC 802C40FC 00000000 */ nop
/* 0E8AB0 802C4100 8FBF0018 */ lw $ra, 0x18($sp)
/* 0E8AB4 802C4104 8FB10014 */ lw $s1, 0x14($sp)
/* 0E8AB8 802C4108 8FB00010 */ lw $s0, 0x10($sp)
/* 0E8ABC 802C410C 03E00008 */ jr $ra
/* 0E8AC0 802C4110 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,16 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80033540
/* 00E940 80033540 3C03800A */ lui $v1, 0x800a
/* 00E944 80033544 2463A650 */ addiu $v1, $v1, -0x59b0
/* 00E948 80033548 8C620000 */ lw $v0, ($v1)
/* 00E94C 8003354C 34420008 */ ori $v0, $v0, 8
/* 00E950 80033550 AC620000 */ sw $v0, ($v1)
/* 00E954 80033554 3C038007 */ lui $v1, 0x8007
/* 00E958 80033558 8C63419C */ lw $v1, 0x419c($v1)
/* 00E95C 8003355C 24020003 */ addiu $v0, $zero, 3
/* 00E960 80033560 03E00008 */ jr $ra
/* 00E964 80033564 A06200AC */ sb $v0, 0xac($v1)

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80033788
/* 00EB88 80033788 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 00EB8C 8003378C 240200FF */ addiu $v0, $zero, 0xff
/* 00EB90 80033790 0000202D */ daddu $a0, $zero, $zero
/* 00EB94 80033794 0080282D */ daddu $a1, $a0, $zero
/* 00EB98 80033798 2406013F */ addiu $a2, $zero, 0x13f
/* 00EB9C 8003379C 240700EF */ addiu $a3, $zero, 0xef
/* 00EBA0 800337A0 AFBF0020 */ sw $ra, 0x20($sp)
/* 00EBA4 800337A4 AFA00010 */ sw $zero, 0x10($sp)
/* 00EBA8 800337A8 AFA00014 */ sw $zero, 0x14($sp)
/* 00EBAC 800337AC AFA00018 */ sw $zero, 0x18($sp)
/* 00EBB0 800337B0 0C00AAD7 */ jal func_8002AB5C
/* 00EBB4 800337B4 AFA2001C */ sw $v0, 0x1c($sp)
/* 00EBB8 800337B8 8FBF0020 */ lw $ra, 0x20($sp)
/* 00EBBC 800337BC 03E00008 */ jr $ra
/* 00EBC0 800337C0 27BD0028 */ addiu $sp, $sp, 0x28
/* 00EBC4 800337C4 00000000 */ nop
/* 00EBC8 800337C8 00000000 */ nop
/* 00EBCC 800337CC 00000000 */ nop

View File

@ -1,37 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel MakeLerp
/* 0F8F60 802D45B0 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F8F64 802D45B4 AFB10014 */ sw $s1, 0x14($sp)
/* 0F8F68 802D45B8 0080882D */ daddu $s1, $a0, $zero
/* 0F8F6C 802D45BC AFBF0018 */ sw $ra, 0x18($sp)
/* 0F8F70 802D45C0 AFB00010 */ sw $s0, 0x10($sp)
/* 0F8F74 802D45C4 8E30000C */ lw $s0, 0xc($s1)
/* 0F8F78 802D45C8 8E050000 */ lw $a1, ($s0)
/* 0F8F7C 802D45CC 0C0B1EAF */ jal get_variable
/* 0F8F80 802D45D0 26100004 */ addiu $s0, $s0, 4
/* 0F8F84 802D45D4 AE2200B4 */ sw $v0, 0xb4($s1)
/* 0F8F88 802D45D8 8E050000 */ lw $a1, ($s0)
/* 0F8F8C 802D45DC 26100004 */ addiu $s0, $s0, 4
/* 0F8F90 802D45E0 0C0B1EAF */ jal get_variable
/* 0F8F94 802D45E4 0220202D */ daddu $a0, $s1, $zero
/* 0F8F98 802D45E8 AE2200B8 */ sw $v0, 0xb8($s1)
/* 0F8F9C 802D45EC 8E050000 */ lw $a1, ($s0)
/* 0F8FA0 802D45F0 26100004 */ addiu $s0, $s0, 4
/* 0F8FA4 802D45F4 0C0B1EAF */ jal get_variable
/* 0F8FA8 802D45F8 0220202D */ daddu $a0, $s1, $zero
/* 0F8FAC 802D45FC AE2200C0 */ sw $v0, 0xc0($s1)
/* 0F8FB0 802D4600 8E050000 */ lw $a1, ($s0)
/* 0F8FB4 802D4604 0C0B1EAF */ jal get_variable
/* 0F8FB8 802D4608 0220202D */ daddu $a0, $s1, $zero
/* 0F8FBC 802D460C AE2200B0 */ sw $v0, 0xb0($s1)
/* 0F8FC0 802D4610 AE2000BC */ sw $zero, 0xbc($s1)
/* 0F8FC4 802D4614 8FBF0018 */ lw $ra, 0x18($sp)
/* 0F8FC8 802D4618 8FB10014 */ lw $s1, 0x14($sp)
/* 0F8FCC 802D461C 8FB00010 */ lw $s0, 0x10($sp)
/* 0F8FD0 802D4620 24020002 */ addiu $v0, $zero, 2
/* 0F8FD4 802D4624 03E00008 */ jr $ra
/* 0F8FD8 802D4628 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -5,65 +5,91 @@
#include "types.h"
typedef struct {
/* 0x000 */ s16 unk_00;
/* 0x002 */ s16 unk_02;
/* 0x004 */ char unk_04[0x44];
/* 0x000 */ u32 currentButtons;
/* 0x004 */ u32 altCurrentButtons; /* used for battle when flag 80000 set */
/* 0x008 */ char unk_08[0x8];
/* 0x010 */ u32 pressedButtons; /* 1 for the frame button begins to be held */
/* 0x014 */ u32 altPressedButtons; /* used for battle when flag 80000 set */
/* 0x018 */ char unk_18[0x8];
/* 0x020 */ u32 heldButtons; /* 1 every 4th frame during hold */
/* 0x024 */ u32 altHeldButtons; /* used for battle when flag 80000 set */
/* 0x028 */ char unk_28[0x8];
/* 0x030 */ u32 prevButtons; /* from previous frame */
/* 0x034 */ char unk_34[0xC];
/* 0x040 */ u8 stickX; /* with deadzone */
/* 0x041 */ u8 altStickX; /* used for battle when flag 80000 set */
/* 0x042 */ char unk_42[0x2];
/* 0x044 */ u8 stickY; /* with deadzone */
/* 0x045 */ u8 altStickY; /* used for battle when flag 80000 set */
/* 0x046 */ char unk_46[0x2];
/* 0x048 */ u16 unk_48[4];
/* 0x050 */ u16 unk_50[4];
/* 0x058 */ char unk_58[0x10];
/* 0x068 */ u16 demoButtonInput;
/* 0x06A */ s8 demoStickX;
/* 0x06B */ s8 demoStickY;
/* 0x06C */ char unk_6C[0x4];
/* 0x070 */ s8 unk_70;
/* 0x071 */ s8 demoState;
/* 0x072 */ s8 unk_72;
/* 0x073 */ char unk_73[2];
/* 0x06C */ u32* mainScriptID;
/* 0x070 */ s8 isBattle;
/* 0x071 */ s8 demoState; /* 0 = not demo, 1 = map demo, 2 = demo transition */
/* 0x072 */ u8 nextDemoScene;
/* 0x073 */ char unk_73[0x2];
/* 0x075 */ s8 unk_75;
/* 0x076 */ char unk_76[3];
/* 0x076 */ char unk_76[0x3];
/* 0x079 */ s8 unk_79;
/* 0x07A */ s8 musicEnabled;
/* 0x07B */ char unk_7B;
/* 0x07C */ s8 unk_7C;
/* 0x07D */ char unk_7D;
/* 0x07E */ s8 unk_7E;
/* 0x07F */ char unk_7F[2];
/* 0x07E */ u8 peachFlags; /* 1 = peach, 2 = transformed, 4 = has umbrella */
/* 0x07F */ u8 peachDisguise; /* 1 = koopatrol, 2 = hammer bros, 3 = clubba */
/* 0x080 */ char unk_80;
/* 0x081 */ s8 unk_81;
/* 0x082 */ s8 unk_82;
/* 0x083 */ s8 unk_83;
/* 0x084 */ char unk_84[2];
/* 0x086 */ s16 unk_86;
/* 0x088 */ s16 unk_88;
/* 0x08A */ s16 unk_8A;
/* 0x084 */ char unk_84[0x2];
/* 0x086 */ s16 areaID;
/* 0x088 */ s16 prevArea;
/* 0x08A */ s16 changedArea;
/* 0x08C */ s16 mapID;
/* 0x08E */ char unk_8E[0x1A];
/* 0x08E */ s16 entryID;
/* 0x090 */ char unk_90[0x3];
/* 0x094 */ f32 exitAngle;
/* 0x098 */ f32 playerPos[3];
/* 0x0A4 */ f32 playerYaw;
/* 0x0A8 */ s8 unk_A8;
/* 0x0A9 */ char unk_A9;
/* 0x0AA */ s8 unk_AA;
/* 0x0AB */ char unk_AB[1];
/* 0x0AC */ s8 unk_AC;
/* 0x0AD */ char unk_AD[0x09];
/* 0x0AB */ char unk_AB[0x1];
/* 0x0AC */ s8 loadMenuState;
/* 0x0AD */ u8 menuCounter;
/* 0x0AE */ char unk_AE[0x08];
/* 0x0B6 */ s16 boot_alpha;
/* 0x0B8 */ s16 boot_blue;
/* 0x0BA */ s16 boot_green;
/* 0x0BC */ s16 boot_red;
/* 0x0BE */ char unk_BE[0x76];
/* 0x134 */ u16 unk_134;
/* 0x136 */ char unk_136[0x6];
/* 0x13C */ s16 unk_13C;
/* 0x13E */ char unk_13E[0xA];
/* 0x148 */ s16 unk_148;
/* 0x14A */ s16 unk_14A;
/* 0x14C */ s16 unk_14C;
/* 0x14E */ s16 unk_14E;
/* 0x150 */ s16 unk_150;
/* 0x152 */ char unk_152[2];
/* 0x154 */ s32 unk_154;
/* 0x158 */ s32 unk_158;
/* 0x0BE */ char unk_BE[0x6A];
/* 0x128 */ f32 playerTraceNormal[3];
/* 0x134 */ u16 frameCounter;
/* 0x138 */ s32 nextRNG;
/* 0x13A */ char unk_13A[0x4];
/* 0x140 */ UNK_PTR shopItemData;
/* 0x144 */ UNK_PTR mapShop;
/* 0x148 */ s16 backgroundFlags;
/* 0x14A */ s16 backgroundMinW;
/* 0x14C */ s16 backgroundMinH;
/* 0x14E */ s16 backgroundMaxW;
/* 0x150 */ s16 backgroundMaxH;
/* 0x152 */ u16 backgroundXOffset;
/* 0x154 */ UNK_PTR backgroundRaster;
/* 0x158 */ UNK_PTR backgroundPalette;
/* 0x15C */ s16 unk_15C;
/* 0x15E */ char unk_15E[0xA];
/* 0x168 */ s32 unk_168;
} game_status;
/* 0x15E */ char unk_15E[0x2];
/* 0x160 */ s16 savedPos[3];
/* 0x166 */ s8 saveSlot;
/* 0x167 */ u8 loadType; /* 0 = from map, 1 = from main menu */
/* 0x168 */ s32 saveCount;
/* 0x16C */ char unk_16C[0x10];
} game_status; // size = 0x178
typedef enum eItemEntityState {
CollisionWithPlayer=3,
@ -485,8 +511,8 @@ typedef struct {
} script_context; // size = 0x168;
typedef struct {
/* 0x00 */ u32 palette;
/* 0x04 */ u32 raster;
/* 0x00 */ u32 raster;
/* 0x04 */ u32 palette;
/* 0x08 */ u16 startX;
/* 0x0A */ u16 startY;
/* 0x0C */ u16 width;

View File

@ -10,11 +10,19 @@ extern player_data gPlayerData;
extern player_status gPlayerStatus;
extern game_status* gGameStatusPtr[1];
extern item_table_entry gItemTable[364];
extern script_context* gWorldScriptList[128];
extern script_context* gBattleScriptList[128];
extern script_context** gCurrentScriptListPtr[128];
extern s8 D_800A0900;
extern s16* D_80151328;
extern s16 D_8010CD10;
extern s16 D_8010CD12;
extern s32 D_801595A0;
extern char gCloudyFlowerFieldsBg[]; // "fla_bg"
extern char gSunnyFlowerFieldsBg[]; // "flb_bg"
extern bg_header gBackgroundImage;
extern s8 D_8014F12F;
// Triggers

View File

@ -16,7 +16,7 @@ INCLUDE_ASM(code_111f0_len_860, func_80035EEC);
void func_800360FC(void) {
game_status* gameStatus = *gGameStatusPtr;
if (gameStatus->unk_AC == 2) {
if (gameStatus->loadMenuState == 2) {
func_800E973C();
}
}
@ -28,11 +28,11 @@ void func_80036130(void) {
D_800A0942 = 0x14;
D_800A0944 = 0x00;
if (gameStatus->unk_88 != gameStatus->unk_86) {
gameStatus->unk_8A = 0x01;
gameStatus->unk_88 = gameStatus->unk_86;
if (gameStatus->prevArea != gameStatus->areaID) {
gameStatus->changedArea = 1;
gameStatus->prevArea = gameStatus->areaID;
} else {
gameStatus->unk_8A = 0;
gameStatus->changedArea = 0;
}
}

View File

@ -35,7 +35,7 @@ s32 func_8002ACDC(void) {
}
s32 heap_malloc(s32 size) {
if ((*gGameStatusPtr)->unk_70 == 0) {
if ((*gGameStatusPtr)->isBattle == 0) {
return general_heap_malloc(size);
} else {
return _heap_malloc(&D_803DA800, size);
@ -43,7 +43,7 @@ s32 heap_malloc(s32 size) {
}
s32 heap_free(s32 size) {
if ((*gGameStatusPtr)->unk_70 != 0) {
if ((*gGameStatusPtr)->isBattle != 0) {
return _heap_free(&D_803DA800, size);
} else {
return general_heap_free(size);

View File

@ -284,7 +284,7 @@ void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
ui_status* uiStatus = &gUIStatus;
s32 iconIndex;
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->unk_134 % 3) == 0)) {
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->frameCounter % 3) == 0)) {
play_sound(0x211);
}
@ -522,7 +522,7 @@ void status_menu_start_blinking_hp(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->hpBlinkTimer = 120;
}
@ -547,7 +547,7 @@ void status_menu_start_blinking_fp(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->fpBlinkTimer = 120;
}
@ -571,7 +571,7 @@ void status_menu_start_blinking_coins(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->coinsBlinkTimer = 120;
}

View File

@ -9,7 +9,7 @@ INCLUDE_ASM(code_dbd70_len_700, clear_trigger_data);
//INCLUDE_ASM(code_dbd70_len_700, init_trigger_list);
void init_trigger_list(void) {
if ((*gGameStatusPtr)->unk_70 == 0) {
if ((*gGameStatusPtr)->isBattle == 0) {
*gCurrentTriggerListPtr = gTriggerList1;
} else {
*gCurrentTriggerListPtr = gTriggerList2;

View File

@ -1,25 +1,26 @@
#include "common.h"
INCLUDE_ASM(code_dc470_len_14c0, load_map_bg);
/* close match
void load_map_bg (s32 arg0) {
s32 tempvar0 = arg0;
s32 flowerfields_bg1 = 0x80140EE0;
s32 tempvar3 = get_variable(0, 0xF5DE0180);
if (tempvar0 == 0) {
return;
}else{
if (tempvar3 > 0x0034) {
if (strcmp(tempvar0, 0x8014F120) == 0) {
tempvar0 = flowerfields_bg1;
}
load_asset_by_name (tempvar0, 0);
void load_map_bg(char* optAssetName) {
UNK_PTR compressedData;
u32 assetSize;
char* assetName;
if (optAssetName == NULL) return;
assetName = optAssetName;
// StoryProgress check
if (get_variable(0, 0xF5DE0180) >= 0x35) {
// Use sunny Flower Fields bg rather than cloudy
// TODO: these globals should be string literals
if (!strcmp(assetName, gCloudyFlowerFieldsBg)) {
assetName = gSunnyFlowerFieldsBg;
}
}
decode_yay0(tempvar0, 0x80200000);
general_heap_free(tempvar0);
compressedData = load_asset_by_name(assetName, &assetSize);
decode_yay0(compressedData, &gBackgroundImage);
general_heap_free(compressedData);
}
*/
void func_80145DF8(void) {
game_status* gameStatus = *gGameStatusPtr;
@ -27,29 +28,29 @@ void func_80145DF8(void) {
D_8014F12F = 0;
gameStatus->unk_15C = 0xB4;
gameStatus->unk_148 &= 0xF0;
gameStatus->backgroundFlags &= 0xF0;
}
void read_background_size(bg_header *bg) {
game_status* gameStatus = *gGameStatusPtr;
gameStatus->unk_14E = bg->width;
gameStatus->unk_150 = bg->height;
gameStatus->unk_14A = bg->startX;
gameStatus->unk_14C = bg->startY;
gameStatus->unk_154 = bg->palette;
gameStatus->unk_158 = bg->raster;
gameStatus->unk_148 |= 1;
gameStatus->backgroundMaxW = bg->width;
gameStatus->backgroundMaxH = bg->height;
gameStatus->backgroundMinW = bg->startX;
gameStatus->backgroundMinH = bg->startY;
gameStatus->backgroundRaster = bg->raster;
gameStatus->backgroundPalette = bg->palette;
gameStatus->backgroundFlags |= 1;
}
void set_background_size(s16 startX, s16 startY, s16 sizeX, s16 sizeY) {
game_status* gameStatus = *gGameStatusPtr;
gameStatus->unk_148 &= ~1;
gameStatus->unk_14E = startX;
gameStatus->unk_150 = startY;
gameStatus->unk_14A = sizeX;
gameStatus->unk_14C = sizeY;
gameStatus->backgroundFlags &= ~1;
gameStatus->backgroundMaxW = startX;
gameStatus->backgroundMaxH = startY;
gameStatus->backgroundMinW = sizeX;
gameStatus->backgroundMinH = sizeY;
}
u16 func_80145E98(s32 arg0, s32 arg1, s32 arg2) {

View File

@ -26,11 +26,43 @@ INCLUDE_ASM(code_e79b0_len_1920, func_802C3EE4);
INCLUDE_ASM(code_e79b0_len_1920, kill_script);
INCLUDE_ASM(code_e79b0_len_1920, kill_script_by_ID);
void* kill_script_by_ID(s32 id) {
s32 i;
script_context* scriptContextPtr;
INCLUDE_ASM(code_e79b0_len_1920, kill_all_scripts);
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
kill_script(scriptContextPtr);
}
}
}
INCLUDE_ASM(code_e79b0_len_1920, does_script_exist);
s32 kill_all_scripts(void) {
s32 i;
script_context* scriptContextPtr;
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
if (scriptContextPtr != NULL) {
kill_script(scriptContextPtr);
}
}
return;
}
s32 does_script_exist(s32 id) {
s32 i;
script_context* scriptContextPtr;
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
return 1;
}
}
return 0;
}
INCLUDE_ASM(code_e79b0_len_1920, does_script_exist_by_ref);
@ -68,9 +100,25 @@ INCLUDE_ASM(code_e79b0_len_1920, suspend_group_others);
INCLUDE_ASM(code_e79b0_len_1920, resume_group_others);
INCLUDE_ASM(code_e79b0_len_1920, get_script_by_index);
script_context* get_script_by_index(s32 index) {
return (*gCurrentScriptListPtr)[index];
}
script_context* get_script_by_id(s32 id) {
s32 i;
script_context* scriptContextPtr;
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
if ((*gCurrentScriptListPtr)[i] != NULL) {
scriptContextPtr = (*gCurrentScriptListPtr)[i];
if (scriptContextPtr->uniqueID == id) {
return scriptContextPtr;
}
}
}
return 0;
}
INCLUDE_ASM(code_e79b0_len_1920, get_script_by_id);
INCLUDE_ASM(code_e79b0_len_1920, set_script_flags);

View File

@ -1,7 +1,12 @@
#include "common.h"
INCLUDE_ASM(code_e940_len_290, func_80033540);
void func_80033540(void) {
D_8009A650[0] |= 8;
(*gGameStatusPtr)->loadMenuState = 3;
}
INCLUDE_ASM(code_e940_len_290, func_80033568);
INCLUDE_ASM(code_e940_len_290, func_80033788);
void func_80033788(void) {
func_8002AB5C(0, 0, 0x13F, 0xEF, 0, 0, 0, 0xFF);
}

View File

@ -1,6 +1,22 @@
#include "common.h"
INCLUDE_ASM(code_f8f60_len_1560, MakeLerp);
s32 MakeLerp(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32* ptrNextPos = *ptrReadPos++;
s32* ptrNextPos2;
s32* ptrNextPos3;
s32* ptrNextPos4;
script->varTable[12] = get_variable(script, ptrNextPos);
ptrNextPos2 = *ptrReadPos++;
script->varTable[13] = get_variable(script, ptrNextPos2);
ptrNextPos3 = *ptrReadPos++;
script->varTable[15] = get_variable(script, ptrNextPos3);
ptrNextPos4 = *ptrReadPos++;
script->varTable[11] = get_variable(script, ptrNextPos4);
script->varTable[14] = 0;
return 2;
}
INCLUDE_ASM(code_f8f60_len_1560, UpdateLerp);

Binary file not shown.

View File

@ -3,6 +3,9 @@ gUIStatus = 0x8010EF58;
gPlayerData = 0x8010F290;
gPlayerStatus = 0x8010EFC8;
gItemTable = 0x800878E0;
gWorldScriptList = 0x802DA490;
gBattleScriptList = 0x802DA690;
gCurrentScriptListPtr = 0x802DA890;
D_80147574 = 0x80147574;
gMapTransitionAlpha = 0x800A0940;
@ -36,6 +39,7 @@ D_8009A650 = 0x8009A650;
D_800A0900 = 0x800A0900;
D_800DC500 = 0x800DC500;
D_8010F6D0 = 0x8010F6D0;
gBackgroundImage = 0x80200000;
D_802C3000 = 0x802C3000;
D_802DBD40 = 0x802DBD40;
D_802E0D90 = 0x802E0D90;
@ -52,6 +56,8 @@ D_00316D90 = 0x00316D90;
D_00316F30 = 0x00316F30;
D_8010D000 = 0x8010D000;
gCloudyFlowerFieldsBg = 0x8014F120;
gSunnyFlowerFieldsBg = 0x8014F128;
D_8014F12F = 0x8014F12F;
D_8014F140 = 0x8014F140;
D_80151308 = 0x80151308;