mirror of
https://github.com/zeldaret/tmc
synced 2026-05-31 17:32:43 -04:00
clang-format
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
FORMAT_OPTS="-i -style=file"
|
||||
TIDY_OPTS="-p . --fix --fix-errors"
|
||||
COMPILER_OPTS="-fno-builtin -std=gnu90 -Iinclude -Isrc -D_LANGUAGE_C -DNON_MATCHING"
|
||||
|
||||
shopt -s globstar
|
||||
|
||||
if (( $# > 0 )); then
|
||||
echo "Formatting file(s) $*"
|
||||
echo "Running clang-format..."
|
||||
clang-format ${FORMAT_OPTS} "$@"
|
||||
echo "Running clang-tidy..."
|
||||
clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} &> /dev/null
|
||||
echo "Adding missing final new lines..."
|
||||
sed -i -e '$a\' "$@"
|
||||
echo "Done formatting file(s) $*"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Formatting C files. This will take a bit"
|
||||
echo "Running clang-format..."
|
||||
clang-format ${FORMAT_OPTS} src/**/*.c
|
||||
clang-format ${FORMAT_OPTS} include/**/*.h
|
||||
echo "Running clang-tidy..."
|
||||
clang-tidy ${TIDY_OPTS} src/**/*.c -- ${COMPILER_OPTS} &> /dev/null
|
||||
clang-format ${FORMAT_OPTS} include/**/*.h
|
||||
echo "Adding missing final new lines..."
|
||||
find src/ -type f -name "*.c" -exec sed -i -e '$a\' {} \;
|
||||
echo "Done formatting all files."
|
||||
+7
-7
@@ -4,13 +4,13 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
u8 areaMetadata;
|
||||
u32 locationIndex;
|
||||
u8 unk;
|
||||
u16 localFlagOffset;
|
||||
u8 filler[19];
|
||||
u8 fadeOut;
|
||||
u8 filler[14];
|
||||
u8 areaMetadata;
|
||||
u32 locationIndex;
|
||||
u8 unk;
|
||||
u16 localFlagOffset;
|
||||
u8 filler[19];
|
||||
u8 fadeOut;
|
||||
u8 filler[14];
|
||||
} Area;
|
||||
|
||||
extern Area gArea;
|
||||
|
||||
@@ -1 +1 @@
|
||||
Entity * CreateEnemy(u8, u8);
|
||||
Entity* CreateEnemy(u8, u8);
|
||||
+7
-7
@@ -4,13 +4,13 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
u32 *cutsceneData;
|
||||
u8 textIndex;
|
||||
u8 filler[11];
|
||||
u16 pauseTime;
|
||||
u8 filler[2];
|
||||
s32 targetX;
|
||||
s32 targetY;
|
||||
u32* cutsceneData;
|
||||
u8 textIndex;
|
||||
u8 filler[11];
|
||||
u16 pauseTime;
|
||||
u8 filler[2];
|
||||
s32 targetX;
|
||||
s32 targetY;
|
||||
} CutsceneBehavior;
|
||||
|
||||
#endif
|
||||
+48
-50
@@ -1,17 +1,16 @@
|
||||
#include "global.h"
|
||||
|
||||
|
||||
#ifndef ENTITY_H
|
||||
#define ENTITY_H
|
||||
|
||||
typedef struct {
|
||||
void *entity1;
|
||||
void *entity2;
|
||||
u8 filler[14];
|
||||
void* entity1;
|
||||
void* entity2;
|
||||
u8 filler[14];
|
||||
} UnkStruct;
|
||||
|
||||
typedef struct {
|
||||
u8 type;
|
||||
u8 type;
|
||||
u8 subtype;
|
||||
u8 parameter1;
|
||||
u8 parameter2;
|
||||
@@ -20,29 +19,28 @@ typedef struct {
|
||||
union SplitWord {
|
||||
s32 WORD;
|
||||
struct {
|
||||
s16 LO, HI;
|
||||
s16 LO, HI;
|
||||
} HALF;
|
||||
};
|
||||
|
||||
union SplitHWord {
|
||||
u16 HWORD;
|
||||
struct {
|
||||
u8 LO, HI;
|
||||
u8 LO, HI;
|
||||
} PACKED HALF;
|
||||
};
|
||||
|
||||
typedef struct Entity
|
||||
{
|
||||
u32 *field_0x0;
|
||||
u32 * field_0x4;
|
||||
EntityType entityType;
|
||||
typedef struct Entity {
|
||||
u32* field_0x0;
|
||||
u32* field_0x4;
|
||||
EntityType entityType;
|
||||
u8 action;
|
||||
u8 previousActionFlag;
|
||||
u8 parameter3;
|
||||
u8 field_0xf;
|
||||
u8 flags;
|
||||
u8 scriptedScene:4;
|
||||
u8 scriptedScene2:4;
|
||||
u8 scriptedScene : 4;
|
||||
u8 scriptedScene2 : 4;
|
||||
s16 spriteTileSize;
|
||||
u8 animationState;
|
||||
u8 direction;
|
||||
@@ -51,28 +49,28 @@ typedef struct Entity
|
||||
union {
|
||||
u8 raw;
|
||||
struct {
|
||||
u8 ss0:2;
|
||||
u8 ss2:1;
|
||||
u8 ss3:1;
|
||||
u8 ss4:1;
|
||||
u8 ss5:1;
|
||||
u8 ss6:1;
|
||||
u8 ss7:1;
|
||||
u8 ss0 : 2;
|
||||
u8 ss2 : 1;
|
||||
u8 ss3 : 1;
|
||||
u8 ss4 : 1;
|
||||
u8 ss5 : 1;
|
||||
u8 ss6 : 1;
|
||||
u8 ss7 : 1;
|
||||
} PACKED b;
|
||||
} PACKED spriteSettings;
|
||||
|
||||
|
||||
struct {
|
||||
u8 b0:2;
|
||||
u8 b1:2;
|
||||
u8 b2:2;
|
||||
u8 b3:2;
|
||||
u8 b0 : 2;
|
||||
u8 b1 : 2;
|
||||
u8 b2 : 2;
|
||||
u8 b3 : 2;
|
||||
} PACKED spriteOrder;
|
||||
|
||||
u8 palette;
|
||||
struct {
|
||||
u8 b0:4;
|
||||
u8 b1:1;
|
||||
u8 b2:3;
|
||||
u8 b0 : 4;
|
||||
u8 b1 : 1;
|
||||
u8 b2 : 3;
|
||||
} PACKED spriteOrientation;
|
||||
u8 filler[2];
|
||||
u8 animationList;
|
||||
@@ -81,13 +79,13 @@ typedef struct Entity
|
||||
s16 nonPlanarMovement;
|
||||
u8 spriteAnimation[3];
|
||||
struct {
|
||||
u8 b0:3;
|
||||
u8 b1:5;
|
||||
u8 b0 : 3;
|
||||
u8 b1 : 5;
|
||||
} PACKED ticks;
|
||||
u16 collisions;
|
||||
union SplitWord x;
|
||||
union SplitWord y;
|
||||
union SplitWord height; // todo
|
||||
union SplitWord x;
|
||||
union SplitWord y;
|
||||
union SplitWord height; // todo
|
||||
u8 collisionLayer;
|
||||
s8 interactType;
|
||||
u8 field_0x3a;
|
||||
@@ -103,22 +101,22 @@ typedef struct Entity
|
||||
u8 field_0x44;
|
||||
u8 currentHealth;
|
||||
s16 field_0x46;
|
||||
u32 * boundingBox;
|
||||
u32* boundingBox;
|
||||
u8 field_0x4c;
|
||||
u8 field_0x4d;
|
||||
u8 field_0x4e;
|
||||
u8 field_0x4f;
|
||||
struct Entity * parent;
|
||||
struct Entity * attachedEntity;
|
||||
struct Entity* parent;
|
||||
struct Entity* attachedEntity;
|
||||
u8 field_0x58;
|
||||
u8 field_0x59;
|
||||
union {
|
||||
u8 all;
|
||||
struct {
|
||||
u8 f0:1;
|
||||
u8 f1:5;
|
||||
u8 f2:1;
|
||||
u8 f3:1;
|
||||
u8 f0 : 1;
|
||||
u8 f1 : 5;
|
||||
u8 f2 : 1;
|
||||
u8 f3 : 1;
|
||||
} PACKED b;
|
||||
} PACKED frames;
|
||||
u8 gfx;
|
||||
@@ -129,22 +127,22 @@ typedef struct Entity
|
||||
u16 spriteVramOffset;
|
||||
u8 spriteOffsetX;
|
||||
u8 spriteOffsetY;
|
||||
u32 * otherEntity;
|
||||
u8 field_0x68;
|
||||
u32* otherEntity;
|
||||
u8 field_0x68;
|
||||
u8 field_0x69;
|
||||
u16 field_0x6a;
|
||||
u8 field_0x6c;
|
||||
u8 field_0x6d;
|
||||
u8 filler4[6];
|
||||
u32 * heldObjectPtr;
|
||||
u8 filler3[2];
|
||||
u16 itemCooldown;
|
||||
u32 field_0x7c;
|
||||
u16 field_0x80;
|
||||
u32* heldObjectPtr;
|
||||
u8 filler3[2];
|
||||
u16 itemCooldown;
|
||||
u32 field_0x7c;
|
||||
u16 field_0x80;
|
||||
u16 field_0x82;
|
||||
union SplitHWord cutsceneBeh;
|
||||
union SplitHWord cutsceneBeh;
|
||||
u16 field_0x86;
|
||||
|
||||
|
||||
} Entity;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#define ENTITYDATA_H
|
||||
#include "global.h"
|
||||
typedef struct {
|
||||
u8 entityType;
|
||||
u8 field_0x1;
|
||||
u8 entitySubtype;
|
||||
u8 entityParameter1;
|
||||
u32 entityParameter2;
|
||||
u16 xPos;
|
||||
u16 yPos;
|
||||
u32 spritePtr;
|
||||
u8 entityType;
|
||||
u8 field_0x1;
|
||||
u8 entitySubtype;
|
||||
u8 entityParameter1;
|
||||
u32 entityParameter2;
|
||||
u16 xPos;
|
||||
u16 yPos;
|
||||
u32 spritePtr;
|
||||
} EntityData;
|
||||
#endif
|
||||
+26
-26
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define TRUE 1
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#if defined(__APPLE__)
|
||||
@@ -20,65 +20,65 @@
|
||||
|
||||
#define ALIGNED(n) __attribute__((aligned(n)))
|
||||
|
||||
#define SOUND_INFO_PTR (*(struct SoundInfo **)0x3007FF0)
|
||||
#define INTR_CHECK (*(u16 *)0x3007FF8)
|
||||
#define INTR_VECTOR (*(void **)0x3007FFC)
|
||||
#define SOUND_INFO_PTR (*(struct SoundInfo**)0x3007FF0)
|
||||
#define INTR_CHECK (*(u16*)0x3007FF8)
|
||||
#define INTR_VECTOR (*(void**)0x3007FFC)
|
||||
|
||||
#define EWRAM_START 0x02000000
|
||||
#define EWRAM_END (EWRAM_START + 0x40000)
|
||||
#define EWRAM_END (EWRAM_START + 0x40000)
|
||||
#define IWRAM_START 0x03000000
|
||||
#define IWRAM_END (IWRAM_START + 0x8000)
|
||||
#define IWRAM_END (IWRAM_START + 0x8000)
|
||||
|
||||
#define PLTT 0x5000000
|
||||
#define PLTT 0x5000000
|
||||
#define PLTT_SIZE 0x400
|
||||
|
||||
#define BG_PLTT PLTT
|
||||
#define BG_PLTT PLTT
|
||||
#define BG_PLTT_SIZE 0x200
|
||||
|
||||
#define OBJ_PLTT (PLTT + 0x200)
|
||||
#define OBJ_PLTT (PLTT + 0x200)
|
||||
#define OBJ_PLTT_SIZE 0x200
|
||||
|
||||
#define VRAM 0x6000000
|
||||
#define VRAM 0x6000000
|
||||
#define VRAM_SIZE 0x18000
|
||||
|
||||
#define BG_VRAM VRAM
|
||||
#define BG_VRAM_SIZE 0x10000
|
||||
#define BG_CHAR_SIZE 0x4000
|
||||
#define BG_SCREEN_SIZE 0x800
|
||||
#define BG_CHAR_ADDR(n) (void *)(BG_VRAM + (BG_CHAR_SIZE * (n)))
|
||||
#define BG_SCREEN_ADDR(n) (void *)(BG_VRAM + (BG_SCREEN_SIZE * (n)))
|
||||
#define BG_TILE_ADDR(n) (void *)(BG_VRAM + (0x80 * (n)))
|
||||
#define BG_VRAM VRAM
|
||||
#define BG_VRAM_SIZE 0x10000
|
||||
#define BG_CHAR_SIZE 0x4000
|
||||
#define BG_SCREEN_SIZE 0x800
|
||||
#define BG_CHAR_ADDR(n) (void*)(BG_VRAM + (BG_CHAR_SIZE * (n)))
|
||||
#define BG_SCREEN_ADDR(n) (void*)(BG_VRAM + (BG_SCREEN_SIZE * (n)))
|
||||
#define BG_TILE_ADDR(n) (void*)(BG_VRAM + (0x80 * (n)))
|
||||
|
||||
#define BG_TILE_H_FLIP(n) (0x400 + (n))
|
||||
#define BG_TILE_V_FLIP(n) (0x800 + (n))
|
||||
|
||||
// text-mode BG
|
||||
#define OBJ_VRAM0 (void *)(VRAM + 0x10000)
|
||||
#define OBJ_VRAM0 (void*)(VRAM + 0x10000)
|
||||
#define OBJ_VRAM0_SIZE 0x8000
|
||||
|
||||
// bitmap-mode BG
|
||||
#define OBJ_VRAM1 (void *)(VRAM + 0x14000)
|
||||
#define OBJ_VRAM1 (void*)(VRAM + 0x14000)
|
||||
#define OBJ_VRAM1_SIZE 0x4000
|
||||
|
||||
#define OAM 0x7000000
|
||||
#define OAM 0x7000000
|
||||
#define OAM_SIZE 0x400
|
||||
|
||||
#define ROM_HEADER_SIZE 0xC0
|
||||
#define ROM_HEADER_SIZE 0xC0
|
||||
|
||||
#define DISPLAY_WIDTH 240
|
||||
#define DISPLAY_WIDTH 240
|
||||
#define DISPLAY_HEIGHT 160
|
||||
|
||||
#define TILE_SIZE_4BPP 32
|
||||
#define TILE_SIZE_8BPP 64
|
||||
|
||||
#define TILE_OFFSET_4BPP(n) ((n) * TILE_SIZE_4BPP)
|
||||
#define TILE_OFFSET_8BPP(n) ((n) * TILE_SIZE_8BPP)
|
||||
#define TILE_OFFSET_4BPP(n) ((n)*TILE_SIZE_4BPP)
|
||||
#define TILE_OFFSET_8BPP(n) ((n)*TILE_SIZE_8BPP)
|
||||
|
||||
#define TOTAL_OBJ_TILE_COUNT 1024
|
||||
|
||||
#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
|
||||
#define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r))
|
||||
#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
|
||||
#define _RGB(r, g, b) ((((b)&0x1F) << 10) + (((g)&0x1F) << 5) + ((r)&0x1F))
|
||||
|
||||
#define RGB_BLACK RGB(0, 0, 0)
|
||||
#define RGB_WHITE RGB(31, 31, 31)
|
||||
@@ -90,6 +90,6 @@
|
||||
#define RGB_CYAN RGB(0, 31, 31)
|
||||
#define RGB_WHITEALPHA (RGB_WHITE | 0x8000)
|
||||
|
||||
#define SYSTEM_CLOCK (16 * 1024 * 1024) // System Clock
|
||||
#define SYSTEM_CLOCK (16 * 1024 * 1024) // System Clock
|
||||
|
||||
#endif // GUARD_GBA_DEFINES
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#ifndef GUARD_GBA_FLASH_INTERNAL_H
|
||||
#define GUARD_GBA_FLASH_INTERNAL_H
|
||||
|
||||
#define FLASH_BASE ((u8 *)0xE000000)
|
||||
#define FLASH_BASE ((u8*)0xE000000)
|
||||
|
||||
#define FLASH_WRITE(addr, data) ((*(vu8 *)(FLASH_BASE + (addr))) = (data))
|
||||
#define FLASH_WRITE(addr, data) ((*(vu8*)(FLASH_BASE + (addr))) = (data))
|
||||
|
||||
#define FLASH_ROM_SIZE_1M 131072 // 1 megabit ROM
|
||||
|
||||
#define SECTORS_PER_BANK 16
|
||||
|
||||
struct FlashSector
|
||||
{
|
||||
struct FlashSector {
|
||||
u32 size;
|
||||
u8 shift;
|
||||
u16 count;
|
||||
@@ -25,21 +24,20 @@ struct FlashType {
|
||||
// TODO: add support for anonymous unions/structs if possible
|
||||
union {
|
||||
struct {
|
||||
u8 makerId;
|
||||
u8 deviceId;
|
||||
u8 makerId;
|
||||
u8 deviceId;
|
||||
} separate;
|
||||
u16 joined;
|
||||
} ids;
|
||||
};
|
||||
|
||||
struct FlashSetupInfo
|
||||
{
|
||||
struct FlashSetupInfo {
|
||||
u16 (*programFlashByte)(u16, u32, u8);
|
||||
u16 (*programFlashSector)(u16, void *);
|
||||
u16 (*programFlashSector)(u16, void*);
|
||||
u16 (*eraseFlashChip)(void);
|
||||
u16 (*eraseFlashSector)(u16);
|
||||
u16 (*WaitForFlashWrite)(u8, u8 *, u8);
|
||||
const u16 *maxTime;
|
||||
u16 (*WaitForFlashWrite)(u8, u8*, u8);
|
||||
const u16* maxTime;
|
||||
struct FlashType type;
|
||||
};
|
||||
|
||||
|
||||
+642
-641
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -5,46 +5,46 @@
|
||||
#define AGBPrintInit()
|
||||
#define AGBPutc(cChr)
|
||||
#define AGBPrint(pBuf)
|
||||
#define AGBPrintf(pBuf, ...)
|
||||
#define AGBPrintf(pBuf, ...)
|
||||
#define AGBPrintFlush1Block()
|
||||
#define AGBPrintFlush()
|
||||
#define AGBAssert(pFile, nLine, pExpression, nStopProgram)
|
||||
#else
|
||||
void AGBPrintInit(void);
|
||||
void AGBPutc(const char cChr);
|
||||
void AGBPrint(const char *pBuf);
|
||||
void AGBPrintf(const char *pBuf, ...);
|
||||
void AGBPrint(const char* pBuf);
|
||||
void AGBPrintf(const char* pBuf, ...);
|
||||
void AGBPrintFlush1Block(void);
|
||||
void AGBPrintFlush(void);
|
||||
void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram);
|
||||
void AGBAssert(const char* pFile, int nLine, const char* pExpression, int nStopProgram);
|
||||
#endif
|
||||
|
||||
#undef AGB_ASSERT
|
||||
#ifdef NDEBUG
|
||||
#define AGB_ASSERT(exp)
|
||||
#define AGB_ASSERT(exp)
|
||||
#else
|
||||
#define AGB_ASSERT(exp) (exp) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #exp, 1);
|
||||
#define AGB_ASSERT(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 1);
|
||||
#endif
|
||||
|
||||
#undef AGB_WARNING
|
||||
#ifdef NDEBUG
|
||||
#define AGB_WARNING(exp)
|
||||
#define AGB_WARNING(exp)
|
||||
#else
|
||||
#define AGB_WARNING(exp) (exp) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #exp, 0);
|
||||
#define AGB_WARNING(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 0);
|
||||
#endif
|
||||
|
||||
// for matching purposes
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define AGB_ASSERT_EX(exp, file, line)
|
||||
#define AGB_ASSERT_EX(exp, file, line)
|
||||
#else
|
||||
#define AGB_ASSERT_EX(exp, file, line) (exp) ? ((void *)0) : AGBAssert(file, line, #exp, 1);
|
||||
#define AGB_ASSERT_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 1);
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define AGB_WARNING_EX(exp, file, line)
|
||||
#define AGB_WARNING_EX(exp, file, line)
|
||||
#else
|
||||
#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void *)0) : AGBAssert(file, line, #exp, 0);
|
||||
#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 0);
|
||||
#endif
|
||||
|
||||
#endif // GUARD_GBA_ISAGBPRINT_H
|
||||
|
||||
+122
-132
@@ -9,66 +9,63 @@
|
||||
|
||||
#define C_V 0x40 // center value for PAN, BEND, and TUNE
|
||||
|
||||
#define SOUND_MODE_REVERB_VAL 0x0000007F
|
||||
#define SOUND_MODE_REVERB_SET 0x00000080
|
||||
#define SOUND_MODE_MAXCHN 0x00000F00
|
||||
#define SOUND_MODE_REVERB_VAL 0x0000007F
|
||||
#define SOUND_MODE_REVERB_SET 0x00000080
|
||||
#define SOUND_MODE_MAXCHN 0x00000F00
|
||||
#define SOUND_MODE_MAXCHN_SHIFT 8
|
||||
#define SOUND_MODE_MASVOL 0x0000F000
|
||||
#define SOUND_MODE_MASVOL 0x0000F000
|
||||
#define SOUND_MODE_MASVOL_SHIFT 12
|
||||
#define SOUND_MODE_FREQ_05734 0x00010000
|
||||
#define SOUND_MODE_FREQ_07884 0x00020000
|
||||
#define SOUND_MODE_FREQ_10512 0x00030000
|
||||
#define SOUND_MODE_FREQ_13379 0x00040000
|
||||
#define SOUND_MODE_FREQ_15768 0x00050000
|
||||
#define SOUND_MODE_FREQ_18157 0x00060000
|
||||
#define SOUND_MODE_FREQ_21024 0x00070000
|
||||
#define SOUND_MODE_FREQ_26758 0x00080000
|
||||
#define SOUND_MODE_FREQ_31536 0x00090000
|
||||
#define SOUND_MODE_FREQ_36314 0x000A0000
|
||||
#define SOUND_MODE_FREQ_40137 0x000B0000
|
||||
#define SOUND_MODE_FREQ_42048 0x000C0000
|
||||
#define SOUND_MODE_FREQ 0x000F0000
|
||||
#define SOUND_MODE_FREQ_SHIFT 16
|
||||
#define SOUND_MODE_DA_BIT_9 0x00800000
|
||||
#define SOUND_MODE_DA_BIT_8 0x00900000
|
||||
#define SOUND_MODE_DA_BIT_7 0x00A00000
|
||||
#define SOUND_MODE_DA_BIT_6 0x00B00000
|
||||
#define SOUND_MODE_DA_BIT 0x00B00000
|
||||
#define SOUND_MODE_FREQ_05734 0x00010000
|
||||
#define SOUND_MODE_FREQ_07884 0x00020000
|
||||
#define SOUND_MODE_FREQ_10512 0x00030000
|
||||
#define SOUND_MODE_FREQ_13379 0x00040000
|
||||
#define SOUND_MODE_FREQ_15768 0x00050000
|
||||
#define SOUND_MODE_FREQ_18157 0x00060000
|
||||
#define SOUND_MODE_FREQ_21024 0x00070000
|
||||
#define SOUND_MODE_FREQ_26758 0x00080000
|
||||
#define SOUND_MODE_FREQ_31536 0x00090000
|
||||
#define SOUND_MODE_FREQ_36314 0x000A0000
|
||||
#define SOUND_MODE_FREQ_40137 0x000B0000
|
||||
#define SOUND_MODE_FREQ_42048 0x000C0000
|
||||
#define SOUND_MODE_FREQ 0x000F0000
|
||||
#define SOUND_MODE_FREQ_SHIFT 16
|
||||
#define SOUND_MODE_DA_BIT_9 0x00800000
|
||||
#define SOUND_MODE_DA_BIT_8 0x00900000
|
||||
#define SOUND_MODE_DA_BIT_7 0x00A00000
|
||||
#define SOUND_MODE_DA_BIT_6 0x00B00000
|
||||
#define SOUND_MODE_DA_BIT 0x00B00000
|
||||
#define SOUND_MODE_DA_BIT_SHIFT 20
|
||||
|
||||
struct WaveData
|
||||
{
|
||||
struct WaveData {
|
||||
u16 type;
|
||||
u16 status;
|
||||
u32 freq;
|
||||
u32 loopStart;
|
||||
u32 size; // number of samples
|
||||
u32 size; // number of samples
|
||||
s8 data[1]; // samples
|
||||
};
|
||||
|
||||
#define TONEDATA_TYPE_CGB 0x07
|
||||
#define TONEDATA_TYPE_FIX 0x08
|
||||
#define TONEDATA_TYPE_SPL 0x40 // key split
|
||||
#define TONEDATA_TYPE_RHY 0x80 // rhythm
|
||||
#define TONEDATA_TYPE_CGB 0x07
|
||||
#define TONEDATA_TYPE_FIX 0x08
|
||||
#define TONEDATA_TYPE_SPL 0x40 // key split
|
||||
#define TONEDATA_TYPE_RHY 0x80 // rhythm
|
||||
|
||||
#define TONEDATA_P_S_PAN 0xc0
|
||||
#define TONEDATA_P_S_PAM TONEDATA_P_S_PAN
|
||||
#define TONEDATA_P_S_PAN 0xc0
|
||||
#define TONEDATA_P_S_PAM TONEDATA_P_S_PAN
|
||||
|
||||
struct ToneData
|
||||
{
|
||||
struct ToneData {
|
||||
u8 type;
|
||||
u8 key;
|
||||
u8 length; // sound length (compatible sound)
|
||||
u8 length; // sound length (compatible sound)
|
||||
u8 pan_sweep; // pan or sweep (compatible sound ch. 1)
|
||||
struct WaveData *wav;
|
||||
struct WaveData* wav;
|
||||
u8 attack;
|
||||
u8 decay;
|
||||
u8 sustain;
|
||||
u8 release;
|
||||
};
|
||||
|
||||
struct CgbChannel
|
||||
{
|
||||
struct CgbChannel {
|
||||
u8 sf;
|
||||
u8 ty;
|
||||
u8 rightVolume;
|
||||
@@ -100,7 +97,7 @@ struct CgbChannel
|
||||
u8 le;
|
||||
u8 sw;
|
||||
u32 fr;
|
||||
u32 *wp;
|
||||
u32* wp;
|
||||
u32 cp;
|
||||
u32 tp;
|
||||
u32 pp;
|
||||
@@ -110,8 +107,7 @@ struct CgbChannel
|
||||
|
||||
struct MusicPlayerTrack;
|
||||
|
||||
struct SoundChannel
|
||||
{
|
||||
struct SoundChannel {
|
||||
u8 status;
|
||||
u8 type;
|
||||
u8 rightVolume;
|
||||
@@ -137,9 +133,9 @@ struct SoundChannel
|
||||
u32 ct;
|
||||
u32 fw;
|
||||
u32 freq;
|
||||
struct WaveData *wav;
|
||||
struct WaveData* wav;
|
||||
u32 cp;
|
||||
struct MusicPlayerTrack *track;
|
||||
struct MusicPlayerTrack* track;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u32 d4;
|
||||
@@ -151,8 +147,7 @@ struct SoundChannel
|
||||
|
||||
#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
|
||||
|
||||
struct SoundInfo
|
||||
{
|
||||
struct SoundInfo {
|
||||
// This field is normally equal to ID_NUMBER but it is set to other
|
||||
// values during sensitive operations for locking purposes.
|
||||
// This field should be volatile but isn't. This could potentially cause
|
||||
@@ -175,39 +170,37 @@ struct SoundInfo
|
||||
s32 pcmSamplesPerVBlank;
|
||||
s32 pcmFreq;
|
||||
s32 divFreq;
|
||||
struct CgbChannel *cgbChans;
|
||||
struct CgbChannel* cgbChans;
|
||||
u32 func;
|
||||
u32 intp;
|
||||
void (*CgbSound)(void);
|
||||
void (*CgbOscOff)(u8);
|
||||
u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
|
||||
u32 MPlayJumpTable;
|
||||
void *plynote;
|
||||
void* plynote;
|
||||
void (*ExtVolPit)(void);
|
||||
u8 gap2[16];
|
||||
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
||||
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
||||
};
|
||||
|
||||
struct SongHeader
|
||||
{
|
||||
struct SongHeader {
|
||||
u8 trackCount;
|
||||
u8 blockCount;
|
||||
u8 priority;
|
||||
u8 reverb;
|
||||
struct ToneData *tone;
|
||||
u8 *part[1];
|
||||
struct ToneData* tone;
|
||||
u8* part[1];
|
||||
};
|
||||
|
||||
#define MPT_FLG_VOLSET 0x01
|
||||
#define MPT_FLG_VOLCHG 0x03
|
||||
#define MPT_FLG_PITSET 0x04
|
||||
#define MPT_FLG_PITCHG 0x0C
|
||||
#define MPT_FLG_START 0x40
|
||||
#define MPT_FLG_EXIST 0x80
|
||||
#define MPT_FLG_START 0x40
|
||||
#define MPT_FLG_EXIST 0x80
|
||||
|
||||
struct MusicPlayerTrack
|
||||
{
|
||||
struct MusicPlayerTrack {
|
||||
u8 flags;
|
||||
u8 wait;
|
||||
u8 patternLevel;
|
||||
@@ -240,13 +233,13 @@ struct MusicPlayerTrack
|
||||
u8 priority;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
struct SoundChannel *chan;
|
||||
struct SoundChannel* chan;
|
||||
struct ToneData tone;
|
||||
u8 gap[10];
|
||||
u16 unk_3A;
|
||||
u32 unk_3C;
|
||||
u8 *cmdPtr;
|
||||
u8 *patternStack[3];
|
||||
u8* cmdPtr;
|
||||
u8* patternStack[3];
|
||||
};
|
||||
|
||||
#define MUSICPLAYER_STATUS_TRACK 0x0000ffff
|
||||
@@ -254,14 +247,13 @@ struct MusicPlayerTrack
|
||||
|
||||
#define MAX_MUSICPLAYER_TRACKS 16
|
||||
|
||||
#define TEMPORARY_FADE 0x0001
|
||||
#define FADE_IN 0x0002
|
||||
#define FADE_VOL_MAX 64
|
||||
#define FADE_VOL_SHIFT 2
|
||||
#define TEMPORARY_FADE 0x0001
|
||||
#define FADE_IN 0x0002
|
||||
#define FADE_VOL_MAX 64
|
||||
#define FADE_VOL_SHIFT 2
|
||||
|
||||
struct MusicPlayerInfo
|
||||
{
|
||||
struct SongHeader *songHeader;
|
||||
struct MusicPlayerInfo {
|
||||
struct SongHeader* songHeader;
|
||||
u32 status;
|
||||
u8 trackCount;
|
||||
u8 priority;
|
||||
@@ -269,7 +261,7 @@ struct MusicPlayerInfo
|
||||
u8 unk_B;
|
||||
u32 clock;
|
||||
u8 gap[8];
|
||||
u8 *memAccArea;
|
||||
u8* memAccArea;
|
||||
u16 tempoD;
|
||||
u16 tempoU;
|
||||
u16 tempoI;
|
||||
@@ -277,24 +269,22 @@ struct MusicPlayerInfo
|
||||
u16 fadeOI;
|
||||
u16 fadeOC;
|
||||
u16 fadeOV;
|
||||
struct MusicPlayerTrack *tracks;
|
||||
struct ToneData *tone;
|
||||
struct MusicPlayerTrack* tracks;
|
||||
struct ToneData* tone;
|
||||
u32 ident;
|
||||
u32 func;
|
||||
u32 intp;
|
||||
};
|
||||
|
||||
struct MusicPlayer
|
||||
{
|
||||
struct MusicPlayerInfo *info;
|
||||
struct MusicPlayerTrack *track;
|
||||
struct MusicPlayer {
|
||||
struct MusicPlayerInfo* info;
|
||||
struct MusicPlayerTrack* track;
|
||||
u8 unk_8;
|
||||
u16 unk_A;
|
||||
};
|
||||
|
||||
struct Song
|
||||
{
|
||||
struct SongHeader *header;
|
||||
struct Song {
|
||||
struct SongHeader* header;
|
||||
u16 ms;
|
||||
u16 me;
|
||||
};
|
||||
@@ -308,9 +298,9 @@ extern u8 gMPlayMemAccArea[];
|
||||
|
||||
extern char SoundMainRAM[];
|
||||
|
||||
extern void *gMPlayJumpTable[];
|
||||
extern void* gMPlayJumpTable[];
|
||||
|
||||
typedef void (*XcmdFunc)(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
typedef void (*XcmdFunc)(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
extern const XcmdFunc gXcmdTable[];
|
||||
|
||||
extern struct CgbChannel gCgbChans[];
|
||||
@@ -333,75 +323,75 @@ extern char gMaxLines[];
|
||||
u32 umul3232H32(u32 multiplier, u32 multiplicand);
|
||||
void SoundMain(void);
|
||||
void SoundMainBTM(void);
|
||||
void TrackStop(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track);
|
||||
void TrackStop(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track);
|
||||
void MPlayMain(void);
|
||||
void RealClearChain(void *x);
|
||||
void RealClearChain(void* x);
|
||||
|
||||
void MPlayContinue(struct MusicPlayerInfo *mplayInfo);
|
||||
void MPlayStart(struct MusicPlayerInfo *mplayInfo, struct SongHeader *songHeader);
|
||||
void MPlayStop(struct MusicPlayerInfo *mplayInfo);
|
||||
void FadeOutBody(struct MusicPlayerInfo *mplayInfo);
|
||||
void TrkVolPitSet(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track);
|
||||
void MPlayFadeOut(struct MusicPlayerInfo *mplayInfo, u16 speed);
|
||||
void ClearChain(void *x);
|
||||
void Clear64byte(void *addr);
|
||||
void SoundInit(struct SoundInfo *soundInfo);
|
||||
void MPlayExtender(struct CgbChannel *cgbChans);
|
||||
void MPlayContinue(struct MusicPlayerInfo* mplayInfo);
|
||||
void MPlayStart(struct MusicPlayerInfo* mplayInfo, struct SongHeader* songHeader);
|
||||
void MPlayStop(struct MusicPlayerInfo* mplayInfo);
|
||||
void FadeOutBody(struct MusicPlayerInfo* mplayInfo);
|
||||
void TrkVolPitSet(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track);
|
||||
void MPlayFadeOut(struct MusicPlayerInfo* mplayInfo, u16 speed);
|
||||
void ClearChain(void* x);
|
||||
void Clear64byte(void* addr);
|
||||
void SoundInit(struct SoundInfo* soundInfo);
|
||||
void MPlayExtender(struct CgbChannel* cgbChans);
|
||||
void m4aSoundMode(u32 mode);
|
||||
void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track, u8 a3);
|
||||
void MPlayOpen(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track, u8 a3);
|
||||
void CgbSound(void);
|
||||
void CgbOscOff(u8);
|
||||
u32 MidiKeyToCgbFreq(u8, u8, u8);
|
||||
void nullsub_141(void);
|
||||
void MPlayJumpTableCopy(void **mplayJumpTable);
|
||||
void MPlayJumpTableCopy(void** mplayJumpTable);
|
||||
void SampleFreqSet(u32 freq);
|
||||
void m4aSoundVSyncOn(void);
|
||||
void m4aSoundVSyncOff(void);
|
||||
|
||||
void m4aMPlayTempoControl(struct MusicPlayerInfo *mplayInfo, u16 tempo);
|
||||
void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 volume);
|
||||
void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s16 pitch);
|
||||
void m4aMPlayPanpotControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s8 pan);
|
||||
void ClearModM(struct MusicPlayerTrack *track);
|
||||
void m4aMPlayModDepthSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 modDepth);
|
||||
void m4aMPlayLFOSpeedSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 lfoSpeed);
|
||||
void m4aMPlayTempoControl(struct MusicPlayerInfo* mplayInfo, u16 tempo);
|
||||
void m4aMPlayVolumeControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u16 volume);
|
||||
void m4aMPlayPitchControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, s16 pitch);
|
||||
void m4aMPlayPanpotControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, s8 pan);
|
||||
void ClearModM(struct MusicPlayerTrack* track);
|
||||
void m4aMPlayModDepthSet(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u8 modDepth);
|
||||
void m4aMPlayLFOSpeedSet(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u8 lfoSpeed);
|
||||
|
||||
// sound command handler functions
|
||||
void ply_fine(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_goto(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_patt(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_pend(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_rept(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_memacc(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_prio(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_tempo(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_keysh(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_voice(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_vol(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_pan(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_bend(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_bendr(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_lfos(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_lfodl(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_mod(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_modt(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_fine(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_goto(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_patt(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_pend(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_rept(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_memacc(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_prio(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_tempo(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_keysh(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_voice(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_vol(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_pan(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_bend(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_bendr(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_lfos(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_lfodl(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_mod(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_modt(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_tune(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_port(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xcmd(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_endtie(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_note(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
|
||||
// extended sound command handler functions
|
||||
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xwave(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xtype(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xatta(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xdeca(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xsust(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xrele(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xiecv(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xiecl(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xleng(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xswee(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xxx(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xwave(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xtype(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xatta(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xdeca(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xsust(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xrele(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xiecv(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xiecl(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xleng(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xswee(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
|
||||
#endif // GUARD_M4A_INTERNAL_H
|
||||
|
||||
+108
-122
@@ -1,54 +1,49 @@
|
||||
#ifndef GUARD_GBA_MACRO_H
|
||||
#define GUARD_GBA_MACRO_H
|
||||
|
||||
#define CPU_FILL(value, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit tmp = (vu##bit)(value); \
|
||||
CpuSet((void *)&tmp, \
|
||||
dest, \
|
||||
CPU_SET_##bit##BIT | CPU_SET_SRC_FIXED | ((size)/(bit/8) & 0x1FFFFF)); \
|
||||
}
|
||||
#define CPU_FILL(value, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit tmp = (vu##bit)(value); \
|
||||
CpuSet((void*)&tmp, dest, CPU_SET_##bit##BIT | CPU_SET_SRC_FIXED | ((size) / (bit / 8) & 0x1FFFFF)); \
|
||||
}
|
||||
|
||||
#define CpuFill16(value, dest, size) CPU_FILL(value, dest, size, 16)
|
||||
#define CpuFill32(value, dest, size) CPU_FILL(value, dest, size, 32)
|
||||
|
||||
#define CPU_COPY(src, dest, size, bit) CpuSet(src, dest, CPU_SET_##bit##BIT | ((size)/(bit/8) & 0x1FFFFF))
|
||||
#define CPU_COPY(src, dest, size, bit) CpuSet(src, dest, CPU_SET_##bit##BIT | ((size) / (bit / 8) & 0x1FFFFF))
|
||||
|
||||
#define CpuCopy16(src, dest, size) CPU_COPY(src, dest, size, 16)
|
||||
#define CpuCopy32(src, dest, size) CPU_COPY(src, dest, size, 32)
|
||||
|
||||
#define CpuFastFill(value, dest, size) \
|
||||
{ \
|
||||
vu32 tmp = (vu32)(value); \
|
||||
CpuFastSet((void *)&tmp, \
|
||||
dest, \
|
||||
CPU_FAST_SET_SRC_FIXED | ((size)/(32/8) & 0x1FFFFF)); \
|
||||
}
|
||||
#define CpuFastFill(value, dest, size) \
|
||||
{ \
|
||||
vu32 tmp = (vu32)(value); \
|
||||
CpuFastSet((void*)&tmp, dest, CPU_FAST_SET_SRC_FIXED | ((size) / (32 / 8) & 0x1FFFFF)); \
|
||||
}
|
||||
|
||||
#define CpuFastFill16(value, dest, size) CpuFastFill(((value) << 16) | (value), (dest), (size))
|
||||
|
||||
#define CpuFastFill8(value, dest, size) CpuFastFill(((value) << 24) | ((value) << 16) | ((value) << 8) | (value), (dest), (size))
|
||||
#define CpuFastFill8(value, dest, size) \
|
||||
CpuFastFill(((value) << 24) | ((value) << 16) | ((value) << 8) | (value), (dest), (size))
|
||||
|
||||
#define CpuFastCopy(src, dest, size) CpuFastSet(src, dest, ((size)/(32/8) & 0x1FFFFF))
|
||||
#define CpuFastCopy(src, dest, size) CpuFastSet(src, dest, ((size) / (32 / 8) & 0x1FFFFF))
|
||||
|
||||
#define DmaSet(dmaNum, src, dest, control) \
|
||||
{ \
|
||||
vu32 *dmaRegs = (vu32 *)REG_ADDR_DMA##dmaNum; \
|
||||
dmaRegs[0] = (vu32)(src); \
|
||||
dmaRegs[1] = (vu32)(dest); \
|
||||
dmaRegs[2] = (vu32)(control); \
|
||||
dmaRegs[2]; \
|
||||
}
|
||||
#define DmaSet(dmaNum, src, dest, control) \
|
||||
{ \
|
||||
vu32* dmaRegs = (vu32*)REG_ADDR_DMA##dmaNum; \
|
||||
dmaRegs[0] = (vu32)(src); \
|
||||
dmaRegs[1] = (vu32)(dest); \
|
||||
dmaRegs[2] = (vu32)(control); \
|
||||
dmaRegs[2]; \
|
||||
}
|
||||
|
||||
#define DMA_FILL(dmaNum, value, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit tmp = (vu##bit)(value); \
|
||||
DmaSet(dmaNum, \
|
||||
&tmp, \
|
||||
dest, \
|
||||
(DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_FIXED | DMA_DEST_INC) << 16 \
|
||||
| ((size)/(bit/8))); \
|
||||
}
|
||||
#define DMA_FILL(dmaNum, value, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit tmp = (vu##bit)(value); \
|
||||
DmaSet(dmaNum, &tmp, dest, \
|
||||
(DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_FIXED | DMA_DEST_INC) << 16 | \
|
||||
((size) / (bit / 8))); \
|
||||
}
|
||||
|
||||
#define DmaFill16(dmaNum, value, dest, size) DMA_FILL(dmaNum, value, dest, size, 16)
|
||||
#define DmaFill32(dmaNum, value, dest, size) DMA_FILL(dmaNum, value, dest, size, 32)
|
||||
@@ -58,86 +53,77 @@
|
||||
// unit size (2 or 4 bytes) and then combined with the DMA control flags using a
|
||||
// bitwise OR operation.
|
||||
|
||||
#define DMA_CLEAR(dmaNum, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit *_dest = (vu##bit *)(dest); \
|
||||
u32 _size = size; \
|
||||
DmaFill##bit(dmaNum, 0, _dest, _size); \
|
||||
}
|
||||
#define DMA_CLEAR(dmaNum, dest, size, bit) \
|
||||
{ \
|
||||
vu##bit* _dest = (vu##bit*)(dest); \
|
||||
u32 _size = size; \
|
||||
DmaFill##bit(dmaNum, 0, _dest, _size); \
|
||||
}
|
||||
|
||||
#define DmaClear16(dmaNum, dest, size) DMA_CLEAR(dmaNum, dest, size, 16)
|
||||
#define DmaClear32(dmaNum, dest, size) DMA_CLEAR(dmaNum, dest, size, 32)
|
||||
|
||||
#define DMA_COPY(dmaNum, src, dest, size, bit) \
|
||||
DmaSet(dmaNum, \
|
||||
src, \
|
||||
dest, \
|
||||
(DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_INC | DMA_DEST_INC) << 16 \
|
||||
| ((size)/(bit/8)))
|
||||
#define DMA_COPY(dmaNum, src, dest, size, bit) \
|
||||
DmaSet(dmaNum, src, dest, \
|
||||
(DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_INC | DMA_DEST_INC) << 16 | ((size) / (bit / 8)))
|
||||
|
||||
#define DmaCopy16(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 16)
|
||||
#define DmaCopy32(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 32)
|
||||
|
||||
#define DmaStop(dmaNum) \
|
||||
{ \
|
||||
vu16 *dmaRegs = (vu16 *)REG_ADDR_DMA##dmaNum; \
|
||||
dmaRegs[5] &= ~(DMA_START_MASK | DMA_DREQ_ON | DMA_REPEAT); \
|
||||
dmaRegs[5] &= ~DMA_ENABLE; \
|
||||
dmaRegs[5]; \
|
||||
}
|
||||
#define DmaStop(dmaNum) \
|
||||
{ \
|
||||
vu16* dmaRegs = (vu16*)REG_ADDR_DMA##dmaNum; \
|
||||
dmaRegs[5] &= ~(DMA_START_MASK | DMA_DREQ_ON | DMA_REPEAT); \
|
||||
dmaRegs[5] &= ~DMA_ENABLE; \
|
||||
dmaRegs[5]; \
|
||||
}
|
||||
|
||||
#define DmaCopyLarge(dmaNum, src, dest, size, block, bit) \
|
||||
{ \
|
||||
const void *_src = src; \
|
||||
void *_dest = dest; \
|
||||
u32 _size = size; \
|
||||
while (1) \
|
||||
{ \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, (block)); \
|
||||
_src += (block); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) \
|
||||
{ \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, _size); \
|
||||
break; \
|
||||
const void* _src = src; \
|
||||
void* _dest = dest; \
|
||||
u32 _size = size; \
|
||||
while (1) { \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, (block)); \
|
||||
_src += (block); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) { \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
#define DmaClearLarge(dmaNum, dest, size, block, bit) \
|
||||
{ \
|
||||
void *_dest = dest; \
|
||||
u32 _size = size; \
|
||||
while (1) \
|
||||
{ \
|
||||
DmaFill##bit(dmaNum, 0, _dest, (block)); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) \
|
||||
{ \
|
||||
DmaFill##bit(dmaNum, 0, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#define DmaClearLarge(dmaNum, dest, size, block, bit) \
|
||||
{ \
|
||||
void* _dest = dest; \
|
||||
u32 _size = size; \
|
||||
while (1) { \
|
||||
DmaFill##bit(dmaNum, 0, _dest, (block)); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) { \
|
||||
DmaFill##bit(dmaNum, 0, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DmaFillLarge(dmaNum, value, dest, size, block, bit) \
|
||||
{ \
|
||||
void *_dest = (void *)dest; \
|
||||
u32 _size = size; \
|
||||
while (1) \
|
||||
{ \
|
||||
DmaFill##bit(dmaNum, value, _dest, (block)); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) \
|
||||
{ \
|
||||
DmaFill##bit(dmaNum, value, _dest, _size); \
|
||||
break; \
|
||||
void* _dest = (void*)dest; \
|
||||
u32 _size = size; \
|
||||
while (1) { \
|
||||
DmaFill##bit(dmaNum, value, _dest, (block)); \
|
||||
_dest += (block); \
|
||||
_size -= (block); \
|
||||
if (_size <= (block)) { \
|
||||
DmaFill##bit(dmaNum, value, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
#define DmaCopyLarge16(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 16)
|
||||
|
||||
@@ -151,44 +137,44 @@
|
||||
#define DmaClearLarge32(dmaNum, dest, size, block) DmaClearLarge(dmaNum, dest, size, block, 32)
|
||||
|
||||
#define DmaCopyDefvars(dmaNum, src, dest, size, bit) \
|
||||
{ \
|
||||
const void *_src = src; \
|
||||
void *_dest = dest; \
|
||||
u32 _size = size; \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, _size); \
|
||||
}
|
||||
{ \
|
||||
const void* _src = src; \
|
||||
void* _dest = dest; \
|
||||
u32 _size = size; \
|
||||
DmaCopy##bit(dmaNum, _src, _dest, _size); \
|
||||
}
|
||||
|
||||
#define DmaCopy16Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 16)
|
||||
#define DmaCopy32Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 32)
|
||||
|
||||
#define DmaFillDefvars(dmaNum, value, dest, size, bit) \
|
||||
{ \
|
||||
void *_dest = (void *)dest; \
|
||||
u32 _size = size; \
|
||||
DmaFill##bit(dmaNum, value, _dest, _size); \
|
||||
}
|
||||
{ \
|
||||
void* _dest = (void*)dest; \
|
||||
u32 _size = size; \
|
||||
DmaFill##bit(dmaNum, value, _dest, _size); \
|
||||
}
|
||||
|
||||
#define DmaFill16Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 16)
|
||||
#define DmaFill32Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 32)
|
||||
|
||||
#define DmaClearDefvars(dmaNum, dest, size, bit) \
|
||||
{ \
|
||||
void *_dest = dest; \
|
||||
u32 _size = size; \
|
||||
DmaClear##bit(dmaNum, _dest, _size); \
|
||||
}
|
||||
{ \
|
||||
void* _dest = dest; \
|
||||
u32 _size = size; \
|
||||
DmaClear##bit(dmaNum, _dest, _size); \
|
||||
}
|
||||
|
||||
#define DmaClear16Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 16)
|
||||
#define DmaClear32Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 32)
|
||||
|
||||
#define IntrEnable(flags) \
|
||||
{ \
|
||||
u16 imeTemp; \
|
||||
\
|
||||
imeTemp = REG_IME; \
|
||||
REG_IME = 0; \
|
||||
REG_IE |= flags; \
|
||||
REG_IME = imeTemp; \
|
||||
}
|
||||
#define IntrEnable(flags) \
|
||||
{ \
|
||||
u16 imeTemp; \
|
||||
\
|
||||
imeTemp = REG_IME; \
|
||||
REG_IME = 0; \
|
||||
REG_IE |= flags; \
|
||||
REG_IME = imeTemp; \
|
||||
}
|
||||
|
||||
#endif // GUARD_GBA_MACRO_H
|
||||
|
||||
+53
-54
@@ -1,40 +1,39 @@
|
||||
#ifndef GUARD_GBA_MULTI_BOOT_H
|
||||
#define GUARD_GBA_MULTI_BOOT_H
|
||||
|
||||
#define MULTIBOOT_NCHILD 3 // Maximum number of slaves
|
||||
#define MULTIBOOT_HEADER_SIZE 0xc0 // Header size
|
||||
#define MULTIBOOT_NCHILD 3 // Maximum number of slaves
|
||||
#define MULTIBOOT_HEADER_SIZE 0xc0 // Header size
|
||||
#define MULTIBOOT_SEND_SIZE_MIN 0x100 // Minimum transmission size
|
||||
#define MULTIBOOT_SEND_SIZE_MAX 0x40000 // Maximum transmission size
|
||||
|
||||
struct MultiBootParam
|
||||
{
|
||||
u32 system_work[5]; // Can be rewritten within system call.
|
||||
// Used with library also.
|
||||
u8 handshake_data; // Handshake data from client
|
||||
struct MultiBootParam {
|
||||
u32 system_work[5]; // Can be rewritten within system call.
|
||||
// Used with library also.
|
||||
u8 handshake_data; // Handshake data from client
|
||||
u8 padding;
|
||||
u16 handshake_timeout; // Handshake timeout check counter
|
||||
u8 probe_count; // If not 0, during client recognition or
|
||||
// boot program transfer
|
||||
u8 client_data[MULTIBOOT_NCHILD]; // Handshake data from client
|
||||
u8 palette_data; // Palette's flashing parameter during load
|
||||
// for client
|
||||
u8 response_bit; // When high probability that slave
|
||||
// connected, 4P-2P: d3-d1 is 1.
|
||||
u8 client_bit; // For slave distinguished as client,
|
||||
// 4P-2P: d3-d1 is 1.
|
||||
u8 reserved1; // Reserved
|
||||
const u8 *boot_srcp; // Boot program start (after header)
|
||||
const u8 *boot_endp; // Boot program end pointer
|
||||
const u8 *masterp; // Pointer to header referenced and output
|
||||
// by master
|
||||
u8 *reserved2[MULTIBOOT_NCHILD]; // Reserved
|
||||
u32 system_work2[4]; // Can be rewritten within system call.
|
||||
u8 sendflag; // If SC7=1 and during send, not 0
|
||||
u8 probe_target_bit; // If target recognized with client,
|
||||
// 4P-2P: d3-d1 is 1.
|
||||
u8 check_wait; // Wait frame until recoginition with client
|
||||
u8 server_type; // client recognize method 0= Low Speed
|
||||
// 1= High Speed
|
||||
u16 handshake_timeout; // Handshake timeout check counter
|
||||
u8 probe_count; // If not 0, during client recognition or
|
||||
// boot program transfer
|
||||
u8 client_data[MULTIBOOT_NCHILD]; // Handshake data from client
|
||||
u8 palette_data; // Palette's flashing parameter during load
|
||||
// for client
|
||||
u8 response_bit; // When high probability that slave
|
||||
// connected, 4P-2P: d3-d1 is 1.
|
||||
u8 client_bit; // For slave distinguished as client,
|
||||
// 4P-2P: d3-d1 is 1.
|
||||
u8 reserved1; // Reserved
|
||||
const u8* boot_srcp; // Boot program start (after header)
|
||||
const u8* boot_endp; // Boot program end pointer
|
||||
const u8* masterp; // Pointer to header referenced and output
|
||||
// by master
|
||||
u8* reserved2[MULTIBOOT_NCHILD]; // Reserved
|
||||
u32 system_work2[4]; // Can be rewritten within system call.
|
||||
u8 sendflag; // If SC7=1 and during send, not 0
|
||||
u8 probe_target_bit; // If target recognized with client,
|
||||
// 4P-2P: d3-d1 is 1.
|
||||
u8 check_wait; // Wait frame until recoginition with client
|
||||
u8 server_type; // client recognize method 0= Low Speed
|
||||
// 1= High Speed
|
||||
};
|
||||
|
||||
/* Error Code
|
||||
@@ -46,30 +45,30 @@ struct MultiBootParam
|
||||
* "Slave is not connected."
|
||||
* "Cannot recognize the slave."
|
||||
* ,etc. Messages easy for the player to understand are good.
|
||||
* NO_PROBE_TARGET: When recognizing client all machines returned
|
||||
* NO_PROBE_TARGET: When recognizing client all machines returned
|
||||
* abnormal data and there is no target.
|
||||
* NO_DLREADY: client did not return a download preparations
|
||||
* NO_DLREADY: client did not return a download preparations
|
||||
* possible message.
|
||||
* BOOT_FAILURE: MultiBoot() system call returned an error.
|
||||
* HANDSHAKE_FAILURE: Failed to do handshake with master which should
|
||||
* HANDSHAKE_FAILURE: Failed to do handshake with master which should
|
||||
* occur immediately after boot of slave.
|
||||
* (Slave may be in infinite loop, request that power be turned off
|
||||
* (Slave may be in infinite loop, request that power be turned off
|
||||
* and on again.)
|
||||
*/
|
||||
#define MULTIBOOT_ERROR_04 0x04
|
||||
#define MULTIBOOT_ERROR_08 0x08
|
||||
#define MULTIBOOT_ERROR_0c 0x0c
|
||||
#define MULTIBOOT_ERROR_40 0x40
|
||||
#define MULTIBOOT_ERROR_44 0x44
|
||||
#define MULTIBOOT_ERROR_48 0x48
|
||||
#define MULTIBOOT_ERROR_4c 0x4c
|
||||
#define MULTIBOOT_ERROR_80 0x80
|
||||
#define MULTIBOOT_ERROR_84 0x84
|
||||
#define MULTIBOOT_ERROR_88 0x88
|
||||
#define MULTIBOOT_ERROR_8c 0x8c
|
||||
#define MULTIBOOT_ERROR_NO_PROBE_TARGET 0x50
|
||||
#define MULTIBOOT_ERROR_NO_DLREADY 0x60
|
||||
#define MULTIBOOT_ERROR_BOOT_FAILURE 0x70
|
||||
#define MULTIBOOT_ERROR_04 0x04
|
||||
#define MULTIBOOT_ERROR_08 0x08
|
||||
#define MULTIBOOT_ERROR_0c 0x0c
|
||||
#define MULTIBOOT_ERROR_40 0x40
|
||||
#define MULTIBOOT_ERROR_44 0x44
|
||||
#define MULTIBOOT_ERROR_48 0x48
|
||||
#define MULTIBOOT_ERROR_4c 0x4c
|
||||
#define MULTIBOOT_ERROR_80 0x80
|
||||
#define MULTIBOOT_ERROR_84 0x84
|
||||
#define MULTIBOOT_ERROR_88 0x88
|
||||
#define MULTIBOOT_ERROR_8c 0x8c
|
||||
#define MULTIBOOT_ERROR_NO_PROBE_TARGET 0x50
|
||||
#define MULTIBOOT_ERROR_NO_DLREADY 0x60
|
||||
#define MULTIBOOT_ERROR_BOOT_FAILURE 0x70
|
||||
#define MULTIBOOT_ERROR_HANDSHAKE_FAILURE 0x71
|
||||
|
||||
/* After an error, or when a value other than 0xffff is returned,
|
||||
@@ -83,22 +82,22 @@ struct MultiBootParam
|
||||
#define MULTIBOOT_CONNECTION_CHECK_WAIT 15
|
||||
|
||||
/* Recognition of Slave
|
||||
* Value set in MultiBootParam structure member server_type
|
||||
* Value set in MultiBootParam structure member server_type
|
||||
* MULTIBOOT_SERVER_TYPE_NORMAL: Slow speed recognition mode
|
||||
* The MultiBootMain() function communicates 2 bytes with one call.
|
||||
* Therefore, processing returns from MultiBootMain() function
|
||||
* Therefore, processing returns from MultiBootMain() function
|
||||
* in short time.
|
||||
* MULTIBOOT_SERVER_TYPE_QUICK: High speed recognition mode
|
||||
* In MultiBootMain() function as many consecutive communications
|
||||
* are done as possible.
|
||||
* Therefore, processing may not return from MultiBootMain() for
|
||||
* Therefore, processing may not return from MultiBootMain() for
|
||||
* several dozen frames.
|
||||
* During this time, there is no problem if processing for sound and
|
||||
* display cannot be done. If processing for sound and display is
|
||||
* During this time, there is no problem if processing for sound and
|
||||
* display cannot be done. If processing for sound and display is
|
||||
* done with timer interrupt processing, you can use.
|
||||
*/
|
||||
#define MULTIBOOT_SERVER_TYPE_NORMAL 0
|
||||
#define MULTIBOOT_SERVER_TYPE_QUICK 1
|
||||
#define MULTIBOOT_SERVER_TYPE_QUICK 1
|
||||
|
||||
/* Timeout for slave's final start up check 400 frames */
|
||||
#define MULTIBOOT_HANDSHAKE_TIMEOUT 400
|
||||
|
||||
+19
-19
@@ -1,15 +1,15 @@
|
||||
#ifndef GUARD_GBA_SYSCALL_H
|
||||
#define GUARD_GBA_SYSCALL_H
|
||||
|
||||
#define RESET_EWRAM 0x01
|
||||
#define RESET_IWRAM 0x02
|
||||
#define RESET_PALETTE 0x04
|
||||
#define RESET_VRAM 0x08
|
||||
#define RESET_OAM 0x10
|
||||
#define RESET_SIO_REGS 0x20
|
||||
#define RESET_EWRAM 0x01
|
||||
#define RESET_IWRAM 0x02
|
||||
#define RESET_PALETTE 0x04
|
||||
#define RESET_VRAM 0x08
|
||||
#define RESET_OAM 0x10
|
||||
#define RESET_SIO_REGS 0x20
|
||||
#define RESET_SOUND_REGS 0x40
|
||||
#define RESET_REGS 0x80
|
||||
#define RESET_ALL 0xFF
|
||||
#define RESET_REGS 0x80
|
||||
#define RESET_ALL 0xFF
|
||||
|
||||
void SoftReset(u32 resetFlags);
|
||||
|
||||
@@ -22,28 +22,28 @@ u16 Sqrt(u32 num);
|
||||
u16 ArcTan2(s16 x, s16 y);
|
||||
|
||||
#define CPU_SET_SRC_FIXED 0x01000000
|
||||
#define CPU_SET_16BIT 0x00000000
|
||||
#define CPU_SET_32BIT 0x04000000
|
||||
#define CPU_SET_16BIT 0x00000000
|
||||
#define CPU_SET_32BIT 0x04000000
|
||||
|
||||
void CpuSet(const void *src, void *dest, u32 control);
|
||||
void CpuSet(const void* src, void* dest, u32 control);
|
||||
|
||||
#define CPU_FAST_SET_SRC_FIXED 0x01000000
|
||||
|
||||
void CpuFastSet(const void *src, void *dest, u32 control);
|
||||
void CpuFastSet(const void* src, void* dest, u32 control);
|
||||
|
||||
void BgAffineSet(struct BgAffineSrcData *src, struct BgAffineDstData *dest, s32 count);
|
||||
void BgAffineSet(struct BgAffineSrcData* src, struct BgAffineDstData* dest, s32 count);
|
||||
|
||||
void ObjAffineSet(struct ObjAffineSrcData *src, void *dest, s32 count, s32 offset);
|
||||
void ObjAffineSet(struct ObjAffineSrcData* src, void* dest, s32 count, s32 offset);
|
||||
|
||||
void LZ77UnCompWram(const void *src, void *dest);
|
||||
void LZ77UnCompWram(const void* src, void* dest);
|
||||
|
||||
void LZ77UnCompVram(const void *src, void *dest);
|
||||
void LZ77UnCompVram(const void* src, void* dest);
|
||||
|
||||
void RLUnCompWram(const void *src, void *dest);
|
||||
void RLUnCompWram(const void* src, void* dest);
|
||||
|
||||
void RLUnCompVram(const void *src, void *dest);
|
||||
void RLUnCompVram(const void* src, void* dest);
|
||||
|
||||
int MultiBoot(struct MultiBootParam *mp);
|
||||
int MultiBoot(struct MultiBootParam* mp);
|
||||
|
||||
s32 Div(s32 num, s32 denom);
|
||||
|
||||
|
||||
+154
-166
@@ -3,119 +3,115 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
typedef volatile u8 vu8;
|
||||
typedef volatile u8 vu8;
|
||||
typedef volatile u16 vu16;
|
||||
typedef volatile u32 vu32;
|
||||
typedef volatile u64 vu64;
|
||||
typedef volatile s8 vs8;
|
||||
typedef volatile s8 vs8;
|
||||
typedef volatile s16 vs16;
|
||||
typedef volatile s32 vs32;
|
||||
typedef volatile s64 vs64;
|
||||
|
||||
typedef float f32;
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
typedef u8 bool8;
|
||||
typedef u8 bool8;
|
||||
typedef u16 bool16;
|
||||
typedef u32 bool32;
|
||||
|
||||
struct BgCnt
|
||||
{
|
||||
u16 priority:2;
|
||||
u16 charBaseBlock:2;
|
||||
u16 dummy:2;
|
||||
u16 mosaic:1;
|
||||
u16 palettes:1;
|
||||
u16 screenBaseBlock:5;
|
||||
u16 areaOverflowMode:1;
|
||||
u16 screenSize:2;
|
||||
struct BgCnt {
|
||||
u16 priority : 2;
|
||||
u16 charBaseBlock : 2;
|
||||
u16 dummy : 2;
|
||||
u16 mosaic : 1;
|
||||
u16 palettes : 1;
|
||||
u16 screenBaseBlock : 5;
|
||||
u16 areaOverflowMode : 1;
|
||||
u16 screenSize : 2;
|
||||
};
|
||||
typedef volatile struct BgCnt vBgCnt;
|
||||
|
||||
struct PlttData
|
||||
{
|
||||
u16 r:5; // red
|
||||
u16 g:5; // green
|
||||
u16 b:5; // blue
|
||||
u16 unused_15:1;
|
||||
struct PlttData {
|
||||
u16 r : 5; // red
|
||||
u16 g : 5; // green
|
||||
u16 b : 5; // blue
|
||||
u16 unused_15 : 1;
|
||||
};
|
||||
|
||||
struct OamData
|
||||
{
|
||||
/*0x00*/ u32 y:8;
|
||||
/*0x01*/ u32 affineMode:2; // 0x1, 0x2 -> 0x4
|
||||
u32 objMode:2; // 0x4, 0x8 -> 0xC
|
||||
u32 mosaic:1; // 0x10
|
||||
u32 bpp:1; // 0x20
|
||||
u32 shape:2; // 0x40, 0x80 -> 0xC0
|
||||
struct OamData {
|
||||
/*0x00*/ u32 y : 8;
|
||||
/*0x01*/ u32 affineMode : 2; // 0x1, 0x2 -> 0x4
|
||||
u32 objMode : 2; // 0x4, 0x8 -> 0xC
|
||||
u32 mosaic : 1; // 0x10
|
||||
u32 bpp : 1; // 0x20
|
||||
u32 shape : 2; // 0x40, 0x80 -> 0xC0
|
||||
|
||||
/*0x02*/ u32 x:9;
|
||||
u32 matrixNum:5; // bits 3/4 are h-flip/v-flip if not in affine mode
|
||||
u32 size:2; // 0x4000, 0x8000 -> 0xC000
|
||||
/*0x02*/ u32 x : 9;
|
||||
u32 matrixNum : 5; // bits 3/4 are h-flip/v-flip if not in affine mode
|
||||
u32 size : 2; // 0x4000, 0x8000 -> 0xC000
|
||||
|
||||
/*0x04*/ u16 tileNum:10; // 0x3FF
|
||||
u16 priority:2; // 0x400, 0x800 -> 0xC00
|
||||
u16 paletteNum:4;
|
||||
/*0x04*/ u16 tileNum : 10; // 0x3FF
|
||||
u16 priority : 2; // 0x400, 0x800 -> 0xC00
|
||||
u16 paletteNum : 4;
|
||||
/*0x06*/ u16 affineParam;
|
||||
};
|
||||
|
||||
#define ST_OAM_HFLIP 0x08
|
||||
#define ST_OAM_VFLIP 0x10
|
||||
#define ST_OAM_HFLIP 0x08
|
||||
#define ST_OAM_VFLIP 0x10
|
||||
#define ST_OAM_MNUM_FLIP_MASK 0x18
|
||||
|
||||
#define ST_OAM_OBJ_NORMAL 0
|
||||
#define ST_OAM_OBJ_BLEND 1
|
||||
#define ST_OAM_OBJ_BLEND 1
|
||||
#define ST_OAM_OBJ_WINDOW 2
|
||||
|
||||
#define ST_OAM_AFFINE_OFF 0
|
||||
#define ST_OAM_AFFINE_OFF 0
|
||||
#define ST_OAM_AFFINE_NORMAL 1
|
||||
#define ST_OAM_AFFINE_ERASE 2
|
||||
#define ST_OAM_AFFINE_ERASE 2
|
||||
#define ST_OAM_AFFINE_DOUBLE 3
|
||||
|
||||
#define ST_OAM_AFFINE_ON_MASK 1
|
||||
#define ST_OAM_AFFINE_ON_MASK 1
|
||||
#define ST_OAM_AFFINE_DOUBLE_MASK 2
|
||||
|
||||
#define ST_OAM_4BPP 0
|
||||
#define ST_OAM_8BPP 1
|
||||
|
||||
#define ST_OAM_SQUARE 0
|
||||
#define ST_OAM_SQUARE 0
|
||||
#define ST_OAM_H_RECTANGLE 1
|
||||
#define ST_OAM_V_RECTANGLE 2
|
||||
|
||||
#define ST_OAM_SIZE_0 0
|
||||
#define ST_OAM_SIZE_1 1
|
||||
#define ST_OAM_SIZE_2 2
|
||||
#define ST_OAM_SIZE_3 3
|
||||
#define ST_OAM_SIZE_0 0
|
||||
#define ST_OAM_SIZE_1 1
|
||||
#define ST_OAM_SIZE_2 2
|
||||
#define ST_OAM_SIZE_3 3
|
||||
|
||||
#define SPRITE_SIZE_8x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_16x16 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_32x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_64x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_8x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_16x16 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_32x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_64x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_SQUARE))
|
||||
|
||||
#define SPRITE_SIZE_16x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x8 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x16 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_64x32 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_16x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x8 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x16 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_64x32 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
|
||||
#define SPRITE_SIZE_8x16 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_8x32 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_16x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_8x16 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_8x32 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_16x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
|
||||
#define SPRITE_SIZE(dim) ((SPRITE_SIZE_##dim >> 2) & 0x03)
|
||||
#define SPRITE_SIZE(dim) ((SPRITE_SIZE_##dim >> 2) & 0x03)
|
||||
#define SPRITE_SHAPE(dim) (SPRITE_SIZE_##dim & 0x03)
|
||||
|
||||
struct BgAffineSrcData
|
||||
{
|
||||
struct BgAffineSrcData {
|
||||
s32 texX;
|
||||
s32 texY;
|
||||
s16 scrX;
|
||||
@@ -125,8 +121,7 @@ struct BgAffineSrcData
|
||||
u16 alpha;
|
||||
};
|
||||
|
||||
struct BgAffineDstData
|
||||
{
|
||||
struct BgAffineDstData {
|
||||
s16 pa;
|
||||
s16 pb;
|
||||
s16 pc;
|
||||
@@ -135,134 +130,127 @@ struct BgAffineDstData
|
||||
s32 dy;
|
||||
};
|
||||
|
||||
struct ObjAffineSrcData
|
||||
{
|
||||
struct ObjAffineSrcData {
|
||||
s16 xScale;
|
||||
s16 yScale;
|
||||
u16 rotation;
|
||||
};
|
||||
|
||||
// Normal SIO Control Structure
|
||||
struct SioNormalCnt
|
||||
{
|
||||
u16 sck_I_O:1; // Clock I/O Select
|
||||
u16 sck:1; // Internal Clock Select
|
||||
u16 ackRecv:1; // Transfer Enable Flag Receive
|
||||
u16 ackSend:1; // Transfer Enable Flag Send
|
||||
u16 unused_6_4:3;
|
||||
u16 enable:1; // SIO Enable
|
||||
u16 unused_11_8:4;
|
||||
u16 mode:2; // Communication Mode Select
|
||||
u16 ifEnable:1; // Interrupt Request Enable
|
||||
u16 unused_15:1;
|
||||
u8 data; // Data
|
||||
u8 unused_31_24;
|
||||
struct SioNormalCnt {
|
||||
u16 sck_I_O : 1; // Clock I/O Select
|
||||
u16 sck : 1; // Internal Clock Select
|
||||
u16 ackRecv : 1; // Transfer Enable Flag Receive
|
||||
u16 ackSend : 1; // Transfer Enable Flag Send
|
||||
u16 unused_6_4 : 3;
|
||||
u16 enable : 1; // SIO Enable
|
||||
u16 unused_11_8 : 4;
|
||||
u16 mode : 2; // Communication Mode Select
|
||||
u16 ifEnable : 1; // Interrupt Request Enable
|
||||
u16 unused_15 : 1;
|
||||
u8 data; // Data
|
||||
u8 unused_31_24;
|
||||
};
|
||||
|
||||
#define ST_SIO_8BIT_MODE 0 // Normal 8-bit communication mode
|
||||
#define ST_SIO_32BIT_MODE 1 // Normal 32-bit communication mode
|
||||
#define ST_SIO_8BIT_MODE 0 // Normal 8-bit communication mode
|
||||
#define ST_SIO_32BIT_MODE 1 // Normal 32-bit communication mode
|
||||
|
||||
#define ST_SIO_SCK_OUT 0 // Select external clock
|
||||
#define ST_SIO_SCK_IN 1 // Select internal clock
|
||||
#define ST_SIO_IN_SCK_256K 0 // Select internal clock 256KHz
|
||||
#define ST_SIO_IN_SCK_2M 1 // Select 2MHz
|
||||
#define ST_SIO_SCK_OUT 0 // Select external clock
|
||||
#define ST_SIO_SCK_IN 1 // Select internal clock
|
||||
#define ST_SIO_IN_SCK_256K 0 // Select internal clock 256KHz
|
||||
#define ST_SIO_IN_SCK_2M 1 // Select 2MHz
|
||||
|
||||
// Multi-player SIO Control Structure
|
||||
struct SioMultiCnt
|
||||
{
|
||||
u16 baudRate:2; // baud rate
|
||||
u16 si:1; // SI terminal
|
||||
u16 sd:1; // SD terminal
|
||||
u16 id:2; // ID
|
||||
u16 error:1; // error flag
|
||||
u16 enable:1; // SIO enable
|
||||
u16 unused_11_8:4;
|
||||
u16 mode:2; // communication mode (should equal 2)
|
||||
u16 ifEnable:1; // IRQ enable
|
||||
u16 unused_15:1;
|
||||
u16 data; // data
|
||||
struct SioMultiCnt {
|
||||
u16 baudRate : 2; // baud rate
|
||||
u16 si : 1; // SI terminal
|
||||
u16 sd : 1; // SD terminal
|
||||
u16 id : 2; // ID
|
||||
u16 error : 1; // error flag
|
||||
u16 enable : 1; // SIO enable
|
||||
u16 unused_11_8 : 4;
|
||||
u16 mode : 2; // communication mode (should equal 2)
|
||||
u16 ifEnable : 1; // IRQ enable
|
||||
u16 unused_15 : 1;
|
||||
u16 data; // data
|
||||
};
|
||||
|
||||
#define ST_SIO_MULTI_MODE 2 // Multi-play communication mode
|
||||
#define ST_SIO_MULTI_MODE 2 // Multi-play communication mode
|
||||
|
||||
#define ST_SIO_9600_BPS 0 // Baud rate 9600 bps
|
||||
#define ST_SIO_38400_BPS 1 // 38400 bps
|
||||
#define ST_SIO_57600_BPS 2 // 57600 bps
|
||||
#define ST_SIO_115200_BPS 3 // 115200 bps
|
||||
#define ST_SIO_MULTI_PARENT 1 // Multi-play communication Connect master
|
||||
#define ST_SIO_MULTI_CHILD 0 // Connect slave
|
||||
#define ST_SIO_9600_BPS 0 // Baud rate 9600 bps
|
||||
#define ST_SIO_38400_BPS 1 // 38400 bps
|
||||
#define ST_SIO_57600_BPS 2 // 57600 bps
|
||||
#define ST_SIO_115200_BPS 3 // 115200 bps
|
||||
#define ST_SIO_MULTI_PARENT 1 // Multi-play communication Connect master
|
||||
#define ST_SIO_MULTI_CHILD 0 // Connect slave
|
||||
|
||||
// UART - SIO Control Structure
|
||||
struct SioUartCnt
|
||||
{
|
||||
u16 baudRate:2; // Baud Rate
|
||||
u16 ctsEnable:1; // Send Signal Enable
|
||||
u16 paritySelect:1; // Parity Even/Odd
|
||||
u16 transDataFull:1; // Transmit Data Full
|
||||
u16 recvDataEmpty:1; // Receive Data Empty
|
||||
u16 error:1; // Error Detect
|
||||
u16 length:1; // Data Length
|
||||
u16 fifoEnable:1; // FIFO Enable
|
||||
u16 parityEnable:1; // Parity Enable
|
||||
u16 transEnable:1; // Transmitter Enable
|
||||
u16 recvEnable:1; // Receiver Enable
|
||||
u16 mode:2; // Communication Mode Select
|
||||
u16 ifEnable:1; // Interrupt Request Enable
|
||||
u16 unused_15:1;
|
||||
u8 data; // Data
|
||||
u8 unused_31_24;
|
||||
struct SioUartCnt {
|
||||
u16 baudRate : 2; // Baud Rate
|
||||
u16 ctsEnable : 1; // Send Signal Enable
|
||||
u16 paritySelect : 1; // Parity Even/Odd
|
||||
u16 transDataFull : 1; // Transmit Data Full
|
||||
u16 recvDataEmpty : 1; // Receive Data Empty
|
||||
u16 error : 1; // Error Detect
|
||||
u16 length : 1; // Data Length
|
||||
u16 fifoEnable : 1; // FIFO Enable
|
||||
u16 parityEnable : 1; // Parity Enable
|
||||
u16 transEnable : 1; // Transmitter Enable
|
||||
u16 recvEnable : 1; // Receiver Enable
|
||||
u16 mode : 2; // Communication Mode Select
|
||||
u16 ifEnable : 1; // Interrupt Request Enable
|
||||
u16 unused_15 : 1;
|
||||
u8 data; // Data
|
||||
u8 unused_31_24;
|
||||
};
|
||||
|
||||
#define ST_SIO_UART_MODE 3 // UART communication mode
|
||||
#define ST_SIO_UART_MODE 3 // UART communication mode
|
||||
|
||||
#define ST_SIO_UART_7BIT 0 // UART communication data length 7 bits
|
||||
#define ST_SIO_UART_8BIT 1 // 8 bits
|
||||
#define ST_SIO_PARITY_EVEN 0 // Even parity
|
||||
#define ST_SIO_PARITY_ODD 1 // Odd parity
|
||||
#define ST_SIO_UART_7BIT 0 // UART communication data length 7 bits
|
||||
#define ST_SIO_UART_8BIT 1 // 8 bits
|
||||
#define ST_SIO_PARITY_EVEN 0 // Even parity
|
||||
#define ST_SIO_PARITY_ODD 1 // Odd parity
|
||||
|
||||
// JOY Bus Communication Control Structure
|
||||
struct JoyCnt
|
||||
{
|
||||
u8 ifReset:1; // JOY Bus Reset Interrupt Request
|
||||
u8 ifRecv:1; // JOY Bus Received Interrupt Request
|
||||
u8 ifSend:1; // JOY Bus Sent Interrupt Request
|
||||
u8 unused_5_3:3;
|
||||
u8 ifEnable:1; // Interrupt Request Enable
|
||||
u8 unused_7:1;
|
||||
struct JoyCnt {
|
||||
u8 ifReset : 1; // JOY Bus Reset Interrupt Request
|
||||
u8 ifRecv : 1; // JOY Bus Received Interrupt Request
|
||||
u8 ifSend : 1; // JOY Bus Sent Interrupt Request
|
||||
u8 unused_5_3 : 3;
|
||||
u8 ifEnable : 1; // Interrupt Request Enable
|
||||
u8 unused_7 : 1;
|
||||
};
|
||||
|
||||
// JOY Bus Communication Status Structure
|
||||
struct JoyStat
|
||||
{
|
||||
u8 unused_0:1;
|
||||
u8 recv:1; // Receive Status
|
||||
u8 unused_2:1;
|
||||
u8 send:1; // Send Status
|
||||
u8 flags:2; // General Flag
|
||||
u8 unused_7_6:2;
|
||||
struct JoyStat {
|
||||
u8 unused_0 : 1;
|
||||
u8 recv : 1; // Receive Status
|
||||
u8 unused_2 : 1;
|
||||
u8 send : 1; // Send Status
|
||||
u8 flags : 2; // General Flag
|
||||
u8 unused_7_6 : 2;
|
||||
};
|
||||
|
||||
// General Input/Output Control Structure
|
||||
struct RCnt
|
||||
{
|
||||
u8 sc:1; // Data
|
||||
u8 sd:1;
|
||||
u8 si:1;
|
||||
u8 so:1;
|
||||
u8 sc_i_o:1; // I/O Select
|
||||
u8 sd_i_o:1;
|
||||
u8 si_i_o:1;
|
||||
u8 so_i_o:1;
|
||||
u8 ifEnable:1; // Interrupt Request Enable
|
||||
u8 unused_13_9:5;
|
||||
u8 sioModeMaster:2; // SIO Mode Master
|
||||
struct RCnt {
|
||||
u8 sc : 1; // Data
|
||||
u8 sd : 1;
|
||||
u8 si : 1;
|
||||
u8 so : 1;
|
||||
u8 sc_i_o : 1; // I/O Select
|
||||
u8 sd_i_o : 1;
|
||||
u8 si_i_o : 1;
|
||||
u8 so_i_o : 1;
|
||||
u8 ifEnable : 1; // Interrupt Request Enable
|
||||
u8 unused_13_9 : 5;
|
||||
u8 sioModeMaster : 2; // SIO Mode Master
|
||||
};
|
||||
|
||||
#define ST_R_SIO_MASTER_MODE 0 // SIO master mode
|
||||
#define ST_R_DIRECT_MODE 2 // General input/output communication mode
|
||||
#define ST_R_JOY_MODE 3 // JOY communication mode
|
||||
#define ST_R_SIO_MASTER_MODE 0 // SIO master mode
|
||||
#define ST_R_DIRECT_MODE 2 // General input/output communication mode
|
||||
#define ST_R_JOY_MODE 3 // JOY communication mode
|
||||
|
||||
#define ST_R_IN 0 // Select input
|
||||
#define ST_R_OUT 1 // Select output
|
||||
#define ST_R_IN 0 // Select input
|
||||
#define ST_R_OUT 1 // Select output
|
||||
|
||||
#endif // GUARD_GBA_TYPES_H
|
||||
|
||||
+13
-12
@@ -11,15 +11,16 @@
|
||||
#define asm_comment(x) asm volatile("@ -- " x " -- ")
|
||||
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
|
||||
|
||||
#if defined (__APPLE__) || defined (__CYGWIN__)
|
||||
#if defined(__APPLE__) || defined(__CYGWIN__)
|
||||
// Get the IDE to stfu
|
||||
|
||||
// We define it this way to fool preproc.
|
||||
#define INCBIN(...) {0}
|
||||
#define INCBIN_U8 INCBIN
|
||||
#define INCBIN(...) \
|
||||
{ 0 }
|
||||
#define INCBIN_U8 INCBIN
|
||||
#define INCBIN_U16 INCBIN
|
||||
#define INCBIN_U32 INCBIN
|
||||
#define INCBIN_S8 INCBIN
|
||||
#define INCBIN_S8 INCBIN
|
||||
#define INCBIN_S16 INCBIN
|
||||
#define INCBIN_S32 INCBIN
|
||||
#define _(x) (x)
|
||||
@@ -28,20 +29,20 @@
|
||||
|
||||
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
#define SWAP(a, b, temp) \
|
||||
{ \
|
||||
temp = a; \
|
||||
a = b; \
|
||||
b = temp; \
|
||||
}
|
||||
#define SWAP(a, b, temp) \
|
||||
{ \
|
||||
temp = a; \
|
||||
a = b; \
|
||||
b = temp; \
|
||||
}
|
||||
|
||||
// useful math macros
|
||||
|
||||
// Converts a number to Q8.8 fixed-point format
|
||||
#define Q_8_8(n) ((s16)((n) * 256))
|
||||
#define Q_8_8(n) ((s16)((n)*256))
|
||||
|
||||
// Converts a number to Q4.12 fixed-point format
|
||||
#define Q_4_12(n) ((s16)((n) * 4096))
|
||||
#define Q_4_12(n) ((s16)((n)*4096))
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) >= (b) ? (a) : (b))
|
||||
|
||||
+15
-15
@@ -2,10 +2,10 @@
|
||||
#define GREATFAIRY_H
|
||||
|
||||
extern u32 __modsi3(u32, u32);
|
||||
extern void InitializeAnimation(Entity *, u32);
|
||||
extern void InitializeAnimation(Entity*, u32);
|
||||
extern void sub_08087380();
|
||||
extern u32 CheckRoomFlag();
|
||||
extern Entity *sub_080873AC(Entity*, u32, u32);
|
||||
extern Entity* sub_080873AC(Entity*, u32, u32);
|
||||
extern void PositionRelative();
|
||||
extern void CopyPosition();
|
||||
extern void DoFade();
|
||||
@@ -19,19 +19,19 @@ extern void sub_080045D4();
|
||||
extern void sub_0806F69C();
|
||||
extern u32 Random();
|
||||
|
||||
extern void (*gGreatFairy[11])(Entity *);
|
||||
extern void (*gGreatFairyBehaviors[6])(Entity *);
|
||||
extern void (*gGreatFairyWings[3])(Entity *);
|
||||
extern void (*gGreatFairyWake[2])(Entity *);
|
||||
extern void (*gGreatFairyMini[3])(Entity *);
|
||||
extern void (*gGreatFairyMiniAnim[3])(Entity *);
|
||||
extern void (*gGreatFairyDrip[2])(Entity *);
|
||||
extern void (*gGreatFairyRipple[2])(Entity *);
|
||||
extern void (*gGreatFairyBigRipple[2])(Entity *);
|
||||
extern void (*gGreatFairyEnergy[2])(Entity *);
|
||||
extern void (*gGreatFairyInteract1[4])(Entity *);
|
||||
extern void (*gGreatFairyInteract2[5])(Entity *);
|
||||
extern void (*gUnk_081207A4[2])(Entity *);
|
||||
extern void (*gGreatFairy[11])(Entity*);
|
||||
extern void (*gGreatFairyBehaviors[6])(Entity*);
|
||||
extern void (*gGreatFairyWings[3])(Entity*);
|
||||
extern void (*gGreatFairyWake[2])(Entity*);
|
||||
extern void (*gGreatFairyMini[3])(Entity*);
|
||||
extern void (*gGreatFairyMiniAnim[3])(Entity*);
|
||||
extern void (*gGreatFairyDrip[2])(Entity*);
|
||||
extern void (*gGreatFairyRipple[2])(Entity*);
|
||||
extern void (*gGreatFairyBigRipple[2])(Entity*);
|
||||
extern void (*gGreatFairyEnergy[2])(Entity*);
|
||||
extern void (*gGreatFairyInteract1[4])(Entity*);
|
||||
extern void (*gGreatFairyInteract2[5])(Entity*);
|
||||
extern void (*gUnk_081207A4[2])(Entity*);
|
||||
|
||||
extern u32 gUnk_0810C2E4;
|
||||
extern RoomControls gRoomControls;
|
||||
|
||||
+13
-13
@@ -4,8 +4,8 @@
|
||||
#define ITEM_H
|
||||
|
||||
/* On hold until naming conflicts are resolved */
|
||||
/*
|
||||
enum
|
||||
/*
|
||||
enum
|
||||
{
|
||||
Untyped,
|
||||
SmithSword = 0x01,
|
||||
@@ -127,15 +127,15 @@
|
||||
LongSpin = 0x75
|
||||
} ItemType;
|
||||
*/
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
u8 behaviorID;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 stateID;
|
||||
u8 filler[4];
|
||||
u8 unk4;
|
||||
u8 filler2[4];
|
||||
u8 unk5;
|
||||
} ItemBehavior;
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
u8 behaviorID;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 stateID;
|
||||
u8 filler[4];
|
||||
u8 unk4;
|
||||
u8 filler2[4];
|
||||
u8 unk5;
|
||||
} ItemBehavior;
|
||||
#endif
|
||||
+52
-52
@@ -5,64 +5,64 @@
|
||||
#include "entity.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[2];
|
||||
u8 jumpStatus;
|
||||
u8 filler2[2];
|
||||
u8 heldObject;
|
||||
u8 pushedObject;
|
||||
u8 unk;
|
||||
u16 unk2;
|
||||
u8 unk3;
|
||||
u8 keepFacing;
|
||||
u8 linkAction;
|
||||
u8 filler3[2];
|
||||
u8 hurtBlinkSpeed;
|
||||
u8 filler4[4];
|
||||
u16 filler5[3];
|
||||
u8 filler6[8];
|
||||
u16 filler7[2];
|
||||
u8 swimState;
|
||||
u8 filler8[5];
|
||||
u8 *unk4;
|
||||
u8 filler[2];
|
||||
u8 jumpStatus;
|
||||
u8 filler2[2];
|
||||
u8 heldObject;
|
||||
u8 pushedObject;
|
||||
u8 unk;
|
||||
u16 unk2;
|
||||
u8 unk3;
|
||||
u8 keepFacing;
|
||||
u8 linkAction;
|
||||
u8 filler3[2];
|
||||
u8 hurtBlinkSpeed;
|
||||
u8 filler4[4];
|
||||
u16 filler5[3];
|
||||
u8 filler6[8];
|
||||
u16 filler7[2];
|
||||
u8 swimState;
|
||||
u8 filler8[5];
|
||||
u8* unk4;
|
||||
union {
|
||||
u32 all;
|
||||
struct {
|
||||
u32 filler9:3;
|
||||
u32 noMinishCap:1;
|
||||
u32 pullingState:1;
|
||||
u32 windyState:1;
|
||||
u32 filler10:4;
|
||||
u32 slipperyState:1;
|
||||
u32 filler11:5;
|
||||
u32 filler11b:16;
|
||||
} PACKED b;
|
||||
struct {
|
||||
u32 filler9 : 3;
|
||||
u32 noMinishCap : 1;
|
||||
u32 pullingState : 1;
|
||||
u32 windyState : 1;
|
||||
u32 filler10 : 4;
|
||||
u32 slipperyState : 1;
|
||||
u32 filler11 : 5;
|
||||
u32 filler11b : 16;
|
||||
} PACKED b;
|
||||
} flags;
|
||||
u8 filler12[6];
|
||||
u16 unk5;
|
||||
u8 filler13[2];
|
||||
u8 swordGoldParticle:1;
|
||||
u8 swordBlueParticle:1;
|
||||
u8 filler14:6;
|
||||
u8 unk6;
|
||||
u8 filler15[75];
|
||||
u8 unk7;
|
||||
u8 filler12[6];
|
||||
u16 unk5;
|
||||
u8 filler13[2];
|
||||
u8 swordGoldParticle : 1;
|
||||
u8 swordBlueParticle : 1;
|
||||
u8 filler14 : 6;
|
||||
u8 unk6;
|
||||
u8 filler15[75];
|
||||
u8 unk7;
|
||||
} LinkState;
|
||||
|
||||
typedef struct {
|
||||
u8 walletType;
|
||||
u8 heartPieces;
|
||||
u8 health;
|
||||
u8 maxHealth;
|
||||
u8 bombCount;
|
||||
u8 arrowCount;
|
||||
u8 bombBagType;
|
||||
u8 quiverType;
|
||||
u8 filler[4];
|
||||
u8 itemOnA;
|
||||
u8 itemonB;
|
||||
u8 filler2[10];
|
||||
u16 rupees;
|
||||
u8 filler3[12];
|
||||
u8 walletType;
|
||||
u8 heartPieces;
|
||||
u8 health;
|
||||
u8 maxHealth;
|
||||
u8 bombCount;
|
||||
u8 arrowCount;
|
||||
u8 bombBagType;
|
||||
u8 quiverType;
|
||||
u8 filler[4];
|
||||
u8 itemOnA;
|
||||
u8 itemonB;
|
||||
u8 filler2[10];
|
||||
u16 rupees;
|
||||
u8 filler3[12];
|
||||
} Stats;
|
||||
|
||||
extern LinkState gLinkState;
|
||||
|
||||
+12
-12
@@ -1,17 +1,17 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
typedef struct { //0x03001000
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
u8 field_0x2;
|
||||
u8 field_0x3;
|
||||
u8 field_0x4;
|
||||
u16 field_0x6;
|
||||
u8 field_0x8;
|
||||
u8 field_0x9;
|
||||
u8 field_0xa;
|
||||
u8 field_0xb;
|
||||
u32 ticks;
|
||||
typedef struct { // 0x03001000
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
u8 field_0x2;
|
||||
u8 field_0x3;
|
||||
u8 field_0x4;
|
||||
u16 field_0x6;
|
||||
u8 field_0x8;
|
||||
u8 field_0x9;
|
||||
u8 field_0xa;
|
||||
u8 field_0xb;
|
||||
u32 ticks;
|
||||
} MainStruct;
|
||||
|
||||
extern s32 sub_08055F70();
|
||||
|
||||
+4
-4
@@ -8,12 +8,12 @@ typedef struct {
|
||||
u8 transitionType;
|
||||
u8 unk4;
|
||||
u8 state;
|
||||
u8 unk6;
|
||||
u8 unk7;
|
||||
u8 unk8;
|
||||
u8 unk6;
|
||||
u8 unk7;
|
||||
u8 unk8;
|
||||
u16 unk2;
|
||||
u16 fadeInTime;
|
||||
u8 filler2 [4];
|
||||
u8 filler2[4];
|
||||
u32 filler3[3];
|
||||
} Menu;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
struct Input {
|
||||
u16 unk0;
|
||||
u16 unk1;
|
||||
u16 unk2;
|
||||
u8 unk3;
|
||||
u8 unk4;
|
||||
u16 unk0;
|
||||
u16 unk1;
|
||||
u16 unk2;
|
||||
u8 unk3;
|
||||
u8 unk4;
|
||||
};
|
||||
|
||||
//void ReadKeyInput(void);
|
||||
// void ReadKeyInput(void);
|
||||
|
||||
+24
-24
@@ -6,8 +6,8 @@
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
u8 areaID;
|
||||
u8 roomID;
|
||||
u8 areaID;
|
||||
u8 roomID;
|
||||
} RoomID;
|
||||
*/
|
||||
|
||||
@@ -15,34 +15,34 @@ typedef struct {
|
||||
u16 unk2;
|
||||
u8 unk3;
|
||||
u8 unk4;
|
||||
u8 areaID;
|
||||
u8 roomID;
|
||||
u8 areaID;
|
||||
u8 roomID;
|
||||
u16 roomOriginX;
|
||||
u16 roomOriginY;
|
||||
s16 roomScrollX;
|
||||
s16 roomScrollY;
|
||||
u8 unk5;
|
||||
u16 roomOriginY;
|
||||
s16 roomScrollX;
|
||||
s16 roomScrollY;
|
||||
u8 unk5;
|
||||
u8 unk6;
|
||||
u8 filler[4];
|
||||
u8 screenShakeMagnitude;
|
||||
u8 unk7;
|
||||
u16 screenShakeTime;
|
||||
u16 filler2[6];
|
||||
u8 filler3[4];
|
||||
u16 filler4[4];
|
||||
Entity * cameraTarget;
|
||||
u8 screenShakeMagnitude;
|
||||
u8 unk7;
|
||||
u16 screenShakeTime;
|
||||
u16 filler2[6];
|
||||
u8 filler3[4];
|
||||
u16 filler4[4];
|
||||
Entity* cameraTarget;
|
||||
} RoomControls;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[6];
|
||||
u8 itemForSaleIndex;
|
||||
u16 unk;
|
||||
u8 unk2;
|
||||
u16 filler2[3];
|
||||
u8 filler3[4];
|
||||
u8 filler4[52];
|
||||
u8 filler5[28];
|
||||
u32 greatFairyState;
|
||||
u8 filler[6];
|
||||
u8 itemForSaleIndex;
|
||||
u16 unk;
|
||||
u8 unk2;
|
||||
u16 filler2[3];
|
||||
u8 filler3[4];
|
||||
u8 filler4[52];
|
||||
u8 filler5[28];
|
||||
u32 greatFairyState;
|
||||
} RoomVars;
|
||||
|
||||
extern RoomControls gRoomControls;
|
||||
|
||||
+49
-49
@@ -4,67 +4,67 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
u16 lcdControl2;
|
||||
u32 unk;
|
||||
u16 lcdControl1;
|
||||
u16 lcdControl2;
|
||||
u32 unk;
|
||||
u16 lcdControl1;
|
||||
} LcdControls;
|
||||
|
||||
typedef struct {
|
||||
u16 bg0Control;
|
||||
u16 bg0xOffset;
|
||||
u16 bg0yOffset;
|
||||
u16 bg0Updated;
|
||||
u32 unk;
|
||||
u16 bg0Control;
|
||||
u16 bg0xOffset;
|
||||
u16 bg0yOffset;
|
||||
u16 bg0Updated;
|
||||
u32 unk;
|
||||
} BgSettings;
|
||||
|
||||
typedef struct {
|
||||
u16 bg2Control;
|
||||
u16 bg2xOffset;
|
||||
u16 bg2yOffset;
|
||||
u16 unk;
|
||||
u32 unk2;
|
||||
u16 bg3Control;
|
||||
u16 bg3xOffset;
|
||||
u16 bg3yOffset;
|
||||
u16 unk4;
|
||||
u32 unk5;
|
||||
u16 bg2Control;
|
||||
u16 bg2xOffset;
|
||||
u16 bg2yOffset;
|
||||
u16 unk;
|
||||
u32 unk2;
|
||||
u16 bg3Control;
|
||||
u16 bg3xOffset;
|
||||
u16 bg3yOffset;
|
||||
u16 unk4;
|
||||
u32 unk5;
|
||||
} BgAffSettings;
|
||||
|
||||
typedef struct {
|
||||
u16 bg2dx;
|
||||
u16 bg2dmx;
|
||||
u16 bg2dy;
|
||||
u16 bg2dmy;
|
||||
u16 bg2xPointLeastSig;
|
||||
u16 bg2xPointMostSig;
|
||||
u16 bg2yPointLeastSig;
|
||||
u16 bg2yPointMostSig;
|
||||
u16 bg3dx;
|
||||
u16 bg3dmx;
|
||||
u16 bg3dy;
|
||||
u16 bg3dmy;
|
||||
u16 bg3xPointLeastSig;
|
||||
u16 bg3xPointMostSig;
|
||||
u16 bg3yPointLeastSig;
|
||||
u16 bg3yPointMostSig;
|
||||
u16 window0HorizontalDimensions;
|
||||
u16 window1HorizontalDimensions;
|
||||
u16 window0VerticalDimensions;
|
||||
u16 window1VerticalDimensions;
|
||||
u16 windowInsideControl;
|
||||
u16 windowOutsideControl;
|
||||
u16 mosaicSize;
|
||||
u16 layerFXControl;
|
||||
u16 alphaBlend;
|
||||
u16 layerBrightness;
|
||||
u16 bg2dx;
|
||||
u16 bg2dmx;
|
||||
u16 bg2dy;
|
||||
u16 bg2dmy;
|
||||
u16 bg2xPointLeastSig;
|
||||
u16 bg2xPointMostSig;
|
||||
u16 bg2yPointLeastSig;
|
||||
u16 bg2yPointMostSig;
|
||||
u16 bg3dx;
|
||||
u16 bg3dmx;
|
||||
u16 bg3dy;
|
||||
u16 bg3dmy;
|
||||
u16 bg3xPointLeastSig;
|
||||
u16 bg3xPointMostSig;
|
||||
u16 bg3yPointLeastSig;
|
||||
u16 bg3yPointMostSig;
|
||||
u16 window0HorizontalDimensions;
|
||||
u16 window1HorizontalDimensions;
|
||||
u16 window0VerticalDimensions;
|
||||
u16 window1VerticalDimensions;
|
||||
u16 windowInsideControl;
|
||||
u16 windowOutsideControl;
|
||||
u16 mosaicSize;
|
||||
u16 layerFXControl;
|
||||
u16 alphaBlend;
|
||||
u16 layerBrightness;
|
||||
} BgControls;
|
||||
|
||||
typedef struct {
|
||||
LcdControls lcd;
|
||||
BgSettings bg1;
|
||||
BgSettings bg2;
|
||||
BgAffSettings affine;
|
||||
BgControls controls;
|
||||
LcdControls lcd;
|
||||
BgSettings bg1;
|
||||
BgSettings bg2;
|
||||
BgAffSettings affine;
|
||||
BgControls controls;
|
||||
} Screen;
|
||||
|
||||
#endif
|
||||
+10
-10
@@ -4,16 +4,16 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
u8 doTextBox;
|
||||
u8 unk;
|
||||
u8 textSpeed;
|
||||
u8 unk3; //HI?
|
||||
u8 textWindowWidth;
|
||||
u8 textWindowHeight;
|
||||
u8 textWindowPosX;
|
||||
u8 textWindowPosY;
|
||||
u16 textIndex;
|
||||
u16 unk2; //HI?
|
||||
u8 doTextBox;
|
||||
u8 unk;
|
||||
u8 textSpeed;
|
||||
u8 unk3; // HI?
|
||||
u8 textWindowWidth;
|
||||
u8 textWindowHeight;
|
||||
u8 textWindowPosX;
|
||||
u8 textWindowPosY;
|
||||
u16 textIndex;
|
||||
u16 unk2; // HI?
|
||||
} TextBox;
|
||||
|
||||
extern TextBox gTextBox;
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
#include "global.h"
|
||||
|
||||
void _DmaFill32(u32 a1, u32 a2, u32 a3)
|
||||
{
|
||||
void _DmaFill32(u32 a1, u32 a2, u32 a3) {
|
||||
DmaFill32(3, a1, a2, a3);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-12
@@ -7,22 +7,19 @@ extern void (*gUnk_08123384[])(Entity*);
|
||||
extern void UpdateSpriteOrderAndFlip(Entity*);
|
||||
extern void LoadAnimation();
|
||||
|
||||
void sub_08097D78(Entity *ent)
|
||||
{
|
||||
void sub_08097D78(Entity* ent) {
|
||||
gUnk_08123384[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_08097D90(Entity *ent)
|
||||
{
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->collisionLayer = 1;
|
||||
ent->ticks.b0 = 0;
|
||||
UpdateSpriteOrderAndFlip(ent);
|
||||
LoadAnimation(ent, 0);
|
||||
void sub_08097D90(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->collisionLayer = 1;
|
||||
ent->ticks.b0 = 0;
|
||||
UpdateSpriteOrderAndFlip(ent);
|
||||
LoadAnimation(ent, 0);
|
||||
}
|
||||
|
||||
void sub_08097DCC(Entity *ent)
|
||||
{
|
||||
void sub_08097DCC(Entity* ent) {
|
||||
sub_080042B8(ent);
|
||||
}
|
||||
|
||||
+22
-28
@@ -1,33 +1,31 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void (*gUnk_081140D4[])(Entity *);
|
||||
extern void (*gUnk_081140D4[])(Entity*);
|
||||
|
||||
extern u16 gUnk_081140CC[];
|
||||
extern Entity gLinkEntity;
|
||||
extern u32 gUnk_030010A0;
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0806D0B0(Entity *);
|
||||
extern void sub_0807DD64(Entity *);
|
||||
extern void sub_0807DDAC(Entity *, u32);
|
||||
extern void sub_0807DDE4(Entity *);
|
||||
extern void sub_0806D0B0(Entity*);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0806D02C(Entity *);
|
||||
extern Entity * sub_0805EB2C(u32, u32, u32, u32, u32);
|
||||
extern void sub_0806D02C(Entity*);
|
||||
extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32);
|
||||
|
||||
void sub_0806CF18(Entity *this)
|
||||
{
|
||||
void sub_0806CF18(Entity* this) {
|
||||
gUnk_081140D4[this->entityType.parameter1](this);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0806CF30(Entity *this)
|
||||
{
|
||||
void sub_0806CF30(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
int iVar3;
|
||||
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 1;
|
||||
@@ -35,19 +33,18 @@ void sub_0806CF30(Entity *this)
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0806D0B0(this);
|
||||
sub_0807DD64(this);
|
||||
}
|
||||
else {
|
||||
sub_0807DDAC(this,0);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
}
|
||||
if (this->previousActionFlag != 2) {
|
||||
|
||||
|
||||
if (this->previousActionFlag < 3) {
|
||||
if ((gUnk_030010A0 & 3) == 0) {
|
||||
iVar3 = this->x.HALF.HI;
|
||||
if (gLinkEntity.x.HALF.HI < iVar3) {
|
||||
if ((this->field_0x68 - 32) < iVar3) {
|
||||
this->x.HALF.HI =- 1;
|
||||
this->x.HALF.HI = -1;
|
||||
}
|
||||
}
|
||||
if (this->x.HALF.HI > gLinkEntity.x.HALF.HI) {
|
||||
@@ -57,8 +54,7 @@ void sub_0806CF30(Entity *this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
bVar1 = this->parameter3 -= 1;
|
||||
if (bVar1 == 0) {
|
||||
uVar2 = Random();
|
||||
@@ -70,18 +66,16 @@ void sub_0806CF30(Entity *this)
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0806CF30(Entity *this)
|
||||
{
|
||||
asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\"");
|
||||
void sub_0806CF30(Entity* this) {
|
||||
asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0806D00C(Entity *this)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = sub_0805EB2C(7,76,7,0,0);
|
||||
void sub_0806D00C(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = sub_0805EB2C(7, 76, 7, 0, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
this->parent = pEVar1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -2,23 +2,19 @@
|
||||
|
||||
extern u8 gArea;
|
||||
|
||||
u32 sub_08052654()
|
||||
{
|
||||
u32 sub_08052654() {
|
||||
return (gArea >> 7) & 1;
|
||||
}
|
||||
|
||||
u32 CheckIsDungeon()
|
||||
{
|
||||
u32 CheckIsDungeon() {
|
||||
return (gArea >> 2) & 1;
|
||||
}
|
||||
|
||||
u32 sub_08052670()
|
||||
{
|
||||
u32 sub_08052670() {
|
||||
return (gArea >> 4) & 1;
|
||||
}
|
||||
|
||||
u32 sub_08052680()
|
||||
{
|
||||
u32 sub_08052680() {
|
||||
return (gArea >> 6) & 1;
|
||||
}
|
||||
|
||||
|
||||
+22
-23
@@ -5,29 +5,28 @@
|
||||
extern void sub_080A2CC0();
|
||||
extern void sub_0806F69C();
|
||||
extern void sub_08004488();
|
||||
extern Entity * sub_0804B128();
|
||||
extern Entity* sub_0804B128();
|
||||
|
||||
void sub_08032358(Entity *ent)
|
||||
{
|
||||
u16 uVar1;
|
||||
Entity *pEVar2;
|
||||
u16 *puVar3;
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
pEVar2 = sub_0804B128((u8)(ent->entityType).parameter1);
|
||||
ent->attachedEntity = pEVar2;
|
||||
sub_080A2CC0((EntityData *)ent,&ent->attachedEntity,&ent->heldObjectPtr);
|
||||
}
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
sub_0806F69C(ent);
|
||||
}
|
||||
(u32)puVar3 = &(ent->heldObjectPtr);
|
||||
uVar1 = *puVar3;
|
||||
*puVar3 = uVar1 - 1;
|
||||
if ((u16)(*puVar3) == 0) {
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
sub_08004488(0x74);
|
||||
void sub_08032358(Entity* ent) {
|
||||
u16 uVar1;
|
||||
Entity* pEVar2;
|
||||
u16* puVar3;
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
pEVar2 = sub_0804B128((u8)(ent->entityType).parameter1);
|
||||
ent->attachedEntity = pEVar2;
|
||||
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->heldObjectPtr);
|
||||
}
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
sub_0806F69C(ent);
|
||||
}
|
||||
(u32) puVar3 = &(ent->heldObjectPtr);
|
||||
uVar1 = *puVar3;
|
||||
*puVar3 = uVar1 - 1;
|
||||
if ((u16)(*puVar3) == 0) {
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
sub_08004488(0x74);
|
||||
}
|
||||
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3);
|
||||
}
|
||||
sub_080A2CC0((EntityData *)ent,&ent->attachedEntity,puVar3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
extern void sub_0806ED78();
|
||||
extern void sub_08067C44();
|
||||
|
||||
extern void (*gCat[9])(Entity *);
|
||||
extern void (*gCat[9])(Entity*);
|
||||
|
||||
//Main
|
||||
void sub_080677B4(Entity *ent)
|
||||
{
|
||||
// Main
|
||||
void sub_080677B4(Entity* ent) {
|
||||
gCat[ent->action](ent);
|
||||
sub_08067C44(ent);
|
||||
if (((ent->flags & 128) == 0) && ((ent->entityType).parameter1 != 5)) {
|
||||
sub_0806ED78(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-66
@@ -3,10 +3,10 @@
|
||||
#include "room.h"
|
||||
#include "link.h"
|
||||
|
||||
extern void sub_0809F7BC(Entity *);
|
||||
extern void sub_0809F7BC(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0809F814(u32);
|
||||
extern void sub_0809F7F4(Entity *);
|
||||
extern void sub_0809F7F4(Entity*);
|
||||
extern void SetGlobalFlag(u32);
|
||||
extern void LoadRoomEntityList();
|
||||
extern void DeleteThisEntity();
|
||||
@@ -15,51 +15,46 @@ extern void sub_08078A90(u32);
|
||||
extern void sub_08078B48(void);
|
||||
extern u32 SetLocalFlag(u32);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0806F69C(Entity *);
|
||||
extern void (*gUnk_08124798[])(Entity *);
|
||||
extern void (*gUnk_081247A0[])(Entity *);
|
||||
extern void (*gUnk_081247AC[])(Entity *);
|
||||
extern Entity * CreateObject(u32, u32, u32);
|
||||
extern void sub_0806FA30(Entity *, Entity *);
|
||||
extern void sub_0807BB68(u32 *, u32, u32);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern void (*gUnk_08124798[])(Entity*);
|
||||
extern void (*gUnk_081247A0[])(Entity*);
|
||||
extern void (*gUnk_081247AC[])(Entity*);
|
||||
extern Entity* CreateObject(u32, u32, u32);
|
||||
extern void sub_0806FA30(Entity*, Entity*);
|
||||
extern void sub_0807BB68(u32*, u32, u32);
|
||||
|
||||
extern u8 gUnk_02034490;
|
||||
extern u32 gUnk_030010A0;
|
||||
extern void *gUnk_080DD750;
|
||||
extern void* gUnk_080DD750;
|
||||
extern Entity gLinkEntity;
|
||||
extern LinkState gLinkState;
|
||||
extern u8 gUnk_081247C0[];
|
||||
extern u16 gUnk_081247C8[];
|
||||
extern u32 gUnk_081247D0;
|
||||
|
||||
void sub_0809F4C4(Entity *this)
|
||||
{
|
||||
void sub_0809F4C4(Entity* this) {
|
||||
gUnk_08124798[(this->entityType).parameter1](this);
|
||||
}
|
||||
|
||||
void sub_0809F4DC(Entity *this)
|
||||
{
|
||||
void sub_0809F4DC(Entity* this) {
|
||||
if ((this->entityType).parameter2 == 0) {
|
||||
gUnk_081247A0[this->action](this);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gUnk_081247AC[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F514(Entity *this)
|
||||
{
|
||||
void sub_0809F514(Entity* this) {
|
||||
this->action = 1;
|
||||
this->parameter3 = 120;
|
||||
this->spriteSettings.b.ss0 = 0;
|
||||
*(u8 *)&this->field_0x68 = 12;
|
||||
*(u8*)&this->field_0x68 = 12;
|
||||
gRoomControls.cameraTarget = this;
|
||||
gUnk_02034490 = 255;
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
|
||||
void sub_0809F548(Entity *this)
|
||||
{
|
||||
void sub_0809F548(Entity* this) {
|
||||
|
||||
if (--this->parameter3 == 0) {
|
||||
this->action = 2;
|
||||
@@ -67,8 +62,7 @@ void sub_0809F548(Entity *this)
|
||||
PlaySFX(285);
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ((gUnk_030010A0 & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
@@ -76,8 +70,7 @@ void sub_0809F548(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F5B0(Entity *this)
|
||||
{
|
||||
void sub_0809F5B0(Entity* this) {
|
||||
if (--this->parameter3 == 0) {
|
||||
PlaySFX(115);
|
||||
SetGlobalFlag(36);
|
||||
@@ -86,17 +79,15 @@ void sub_0809F5B0(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F5DC(Entity *this)
|
||||
{
|
||||
void sub_0809F5DC(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 0;
|
||||
*(u8 *)&this->field_0x68 = 12;
|
||||
*(u8*)&this->field_0x68 = 12;
|
||||
}
|
||||
|
||||
void sub_0809F5F0(Entity *this)
|
||||
{
|
||||
void sub_0809F5F0(Entity* this) {
|
||||
u32 iVar1;
|
||||
|
||||
|
||||
iVar1 = CheckRoomFlag(this->parameter3);
|
||||
if (iVar1 != 0) {
|
||||
this->action = 2;
|
||||
@@ -107,9 +98,8 @@ void sub_0809F5F0(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F61C(Entity *this)
|
||||
{
|
||||
|
||||
void sub_0809F61C(Entity* this) {
|
||||
|
||||
if ((gRoomControls.unk6 & 4) == 0) {
|
||||
if (this->parameter3 == 30) {
|
||||
SetLocalFlag(this->entityType.parameter2);
|
||||
@@ -119,8 +109,8 @@ void sub_0809F61C(Entity *this)
|
||||
this->parameter3 = 120;
|
||||
PlaySFX(285);
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); }
|
||||
else {
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
} else {
|
||||
if ((gUnk_030010A0 & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
@@ -129,8 +119,7 @@ void sub_0809F61C(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F69C(Entity *this)
|
||||
{
|
||||
void sub_0809F69C(Entity* this) {
|
||||
|
||||
if (--this->parameter3 == 0) {
|
||||
this->parameter3 = 30;
|
||||
@@ -140,21 +129,18 @@ void sub_0809F69C(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F6CC(Entity *this)
|
||||
{
|
||||
|
||||
if (((gRoomControls.unk6 & 4) == 0) &&
|
||||
(--this->parameter3 == 0)) {
|
||||
void sub_0809F6CC(Entity* this) {
|
||||
|
||||
if (((gRoomControls.unk6 & 4) == 0) && (--this->parameter3 == 0)) {
|
||||
gLinkState.unk7 = 1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F700(Entity *this)
|
||||
{
|
||||
void sub_0809F700(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->parameter3 = (Random() & 30) + 8;
|
||||
@@ -172,12 +158,11 @@ void sub_0809F700(Entity *this)
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
Entity * sub_0809F770(Entity *this)
|
||||
{
|
||||
Entity *cloud;
|
||||
Entity* sub_0809F770(Entity* this) {
|
||||
Entity* cloud;
|
||||
s32 uVar1;
|
||||
|
||||
cloud = CreateObject(163,1,0);
|
||||
|
||||
cloud = CreateObject(163, 1, 0);
|
||||
if (cloud != NULL) {
|
||||
sub_0806FA30(this, cloud);
|
||||
uVar1 = Random();
|
||||
@@ -190,18 +175,16 @@ Entity * sub_0809F770(Entity *this)
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
Entity * sub_0809F770(Entity *this)
|
||||
{
|
||||
asm(".include \"asm/non_matching/cloud/sub_0809F770.inc\"");
|
||||
Entity* sub_0809F770(Entity* this) {
|
||||
asm(".include \"asm/non_matching/cloud/sub_0809F770.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0809F7BC(Entity *this)
|
||||
{
|
||||
Entity *cloud;
|
||||
void sub_0809F7BC(Entity* this) {
|
||||
Entity* cloud;
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
|
||||
for (uVar2 = 0; uVar2 < 8; uVar2++) {
|
||||
cloud = sub_0809F770(this);
|
||||
if (cloud != NULL) {
|
||||
@@ -212,12 +195,11 @@ void sub_0809F7BC(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F7F4(Entity *this)
|
||||
{
|
||||
void sub_0809F7F4(Entity* this) {
|
||||
u8 cVar1;
|
||||
u8 *puVar2;
|
||||
|
||||
puVar2 = (u8 *)&this->field_0x68;
|
||||
u8* puVar2;
|
||||
|
||||
puVar2 = (u8*)&this->field_0x68;
|
||||
*puVar2 -= 1;
|
||||
|
||||
if (*puVar2 == 0) {
|
||||
@@ -226,7 +208,6 @@ void sub_0809F7F4(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F814(u32 r0)
|
||||
{
|
||||
void sub_0809F814(u32 r0) {
|
||||
sub_0807BB68(&gUnk_081247D0, r0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
|
||||
extern void PositionRelative();
|
||||
|
||||
void CopyPosition(Entity *param_1,Entity *param_2)
|
||||
void CopyPosition(Entity* param_1, Entity* param_2)
|
||||
|
||||
{
|
||||
PositionRelative(param_1,param_2,0,0);
|
||||
PositionRelative(param_1, param_2, 0, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ void sub_08068FC0(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->animationState = ent->entityType.parameter2;
|
||||
ent->nonPlanarMovement = 0x40;
|
||||
|
||||
|
||||
ent->field_0x6d = 0xFF;
|
||||
|
||||
|
||||
r2 = sub_0805ACC0(ent);
|
||||
if (r2 == 0) {
|
||||
u16 x, y;
|
||||
@@ -49,7 +49,7 @@ void sub_08068FC0(Entity* ent) {
|
||||
ent->field_0x6a = y;
|
||||
} else {
|
||||
u32 var1 = r2 >> 16;
|
||||
//0x68+0x69 probably a SplitWord
|
||||
// 0x68+0x69 probably a SplitWord
|
||||
*(u16*)&ent->field_0x68 = var1;
|
||||
ent->field_0x6a = r2;
|
||||
}
|
||||
@@ -71,17 +71,17 @@ void sub_08069018(Entity* ent) {
|
||||
var0 = --ent->field_0xf;
|
||||
if (var0 == 0) {
|
||||
if (ent->parameter3 == 0) {
|
||||
ent->action = 2;
|
||||
ent->action = 2;
|
||||
} else {
|
||||
ent->action = 3;
|
||||
ent->action = 3;
|
||||
}
|
||||
ent->previousActionFlag = var0;
|
||||
}
|
||||
|
||||
|
||||
sub_0806924C(ent);
|
||||
}
|
||||
|
||||
void sub_08069068(Entity *ent) {
|
||||
void sub_08069068(Entity* ent) {
|
||||
s32 var0;
|
||||
|
||||
if (ent->previousActionFlag == 0) {
|
||||
@@ -103,7 +103,7 @@ void sub_08069068(Entity *ent) {
|
||||
|
||||
{
|
||||
s32 x = ent->x.HALF.HI;
|
||||
s16 *x2 = (s16 *)&ent->field_0x68;
|
||||
s16* x2 = (s16*)&ent->field_0x68;
|
||||
x -= *x2;
|
||||
if (x > 16) {
|
||||
ent->x.HALF.HI = *x2 + 16;
|
||||
@@ -116,7 +116,7 @@ void sub_08069068(Entity *ent) {
|
||||
}
|
||||
{
|
||||
s32 y = ent->y.HALF.HI;
|
||||
s16 *y2 = &ent->field_0x6a;
|
||||
s16* y2 = &ent->field_0x6a;
|
||||
y -= *y2;
|
||||
if (y > 16) {
|
||||
ent->y.HALF.HI = *y2 + 16;
|
||||
@@ -159,10 +159,12 @@ void sub_08069168(Entity* ent) {
|
||||
}
|
||||
|
||||
void sub_08069188(Entity* ent) {
|
||||
if (ent->frames.b.f0 == 0) return;
|
||||
if (ent->frames.b.f0 == 0)
|
||||
return;
|
||||
ent->frames.all = 0;
|
||||
|
||||
if (((s8) --ent->field_0xf) != 0) return;
|
||||
if (((s8)--ent->field_0xf) != 0)
|
||||
return;
|
||||
ent->previousActionFlag = 3;
|
||||
LoadAnimation(ent, ent->animationState + 16);
|
||||
}
|
||||
@@ -182,7 +184,7 @@ void sub_080691E0(Entity* ent) {
|
||||
}
|
||||
}
|
||||
|
||||
//Show dialogue
|
||||
// Show dialogue
|
||||
void sub_080691F8(Entity* ent) {
|
||||
u32 var0 = ent->entityType.parameter1;
|
||||
u32* var1 = gUnk_08111938 + (var0 * 2);
|
||||
@@ -190,7 +192,7 @@ void sub_080691F8(Entity* ent) {
|
||||
}
|
||||
|
||||
void sub_0806920C(Entity* ent) {
|
||||
//TODO: figure out what bitfield flag this is
|
||||
// TODO: figure out what bitfield flag this is
|
||||
u32 var0 = gLinkState.flags.all & 0x80;
|
||||
u32 var1 = -var0 >> 0x1F;
|
||||
|
||||
@@ -205,11 +207,11 @@ void sub_0806920C(Entity* ent) {
|
||||
ent->field_0x6d = var1;
|
||||
}
|
||||
|
||||
//Check if player interacting
|
||||
// Check if player interacting
|
||||
void sub_0806924C(Entity* ent) {
|
||||
s8 itype = ent->interactType;
|
||||
if (itype != 0) {
|
||||
//TODO: figure out what bitfield flag this is
|
||||
// TODO: figure out what bitfield flag this is
|
||||
if ((gLinkState.flags.all & 0x80) != 0) {
|
||||
if (itype == 2) {
|
||||
ent->action = 4;
|
||||
|
||||
+7
-8
@@ -1,19 +1,18 @@
|
||||
#include "entity.h"
|
||||
#include "global.h"
|
||||
|
||||
extern Entity * GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity *, u8);
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
|
||||
Entity* CreateEnemy(u32 subtype, u32 param1) {
|
||||
Entity* enemy;
|
||||
|
||||
Entity * CreateEnemy(u32 subtype, u32 param1)
|
||||
{
|
||||
Entity *enemy;
|
||||
|
||||
enemy = GetEmptyEntity();
|
||||
if (enemy != NULL) {
|
||||
(enemy->entityType).type = 3;
|
||||
(enemy->entityType).subtype = subtype;
|
||||
(enemy->entityType).parameter1 = param1;
|
||||
sub_0805EA2C(enemy,4);
|
||||
sub_0805EA2C(enemy, 4);
|
||||
}
|
||||
return enemy;
|
||||
}
|
||||
}
|
||||
|
||||
+38
-38
@@ -2,7 +2,7 @@
|
||||
// #include "entityData.h"
|
||||
// #include "global.h"
|
||||
|
||||
// extern Entity * sub_0805EB9C(u32, u32);
|
||||
// extern Entity * sub_0805EB9C(u32, u32);
|
||||
// extern Entity * sub_0805E768();
|
||||
// extern void sub_0804AEB0(Entity *, EntityData *);
|
||||
// extern u32 sub_0804AF0C(Entity *, EntityData *);
|
||||
@@ -11,41 +11,41 @@
|
||||
|
||||
// Entity * CreateEntity(EntityData *param_1)
|
||||
// {
|
||||
// Entity *preexisting;
|
||||
// Entity *entity;
|
||||
// s32 type;
|
||||
|
||||
// type = param_1->entityType & 15;
|
||||
// if (((param_1->field_0x1 & 240) == 80) &&
|
||||
// (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) {
|
||||
// entity = NULL;
|
||||
// }
|
||||
// else {
|
||||
// entity = sub_0805E768(); //Get empty entity
|
||||
// if (entity != NULL) {
|
||||
// (entity->entityType).type = type;
|
||||
// (entity->entityType).subtype = param_1->entitySubtype;
|
||||
// (entity->entityType).parameter1 = param_1->entityParameter1;
|
||||
// sub_0804AEB0(entity,param_1);
|
||||
// if ((param_1->field_0x1 & 240) != 16) {
|
||||
// (entity->entityType).parameter2 = *(u8 *)¶m_1->entityParameter2;
|
||||
// /* i suspect this is where the entity's behavior is defined. Not sure. */
|
||||
// entity->parameter3 = (u8)((u32)param_1->entityParameter2 >> 8);
|
||||
// if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) {
|
||||
// if ((param_1->entityType & 16) == 0) {
|
||||
// if ((param_1->entityType & 32) != 0) {
|
||||
// entity->collisionLayer = 2;
|
||||
// return entity;
|
||||
// }
|
||||
// if ((gRoomControls & 2) == 0) {
|
||||
// sub_08016A30(entity);
|
||||
// return entity;
|
||||
// }
|
||||
// }
|
||||
// entity->collisionLayer = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return entity;
|
||||
// Entity *preexisting;
|
||||
// Entity *entity;
|
||||
// s32 type;
|
||||
|
||||
// type = param_1->entityType & 15;
|
||||
// if (((param_1->field_0x1 & 240) == 80) &&
|
||||
// (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) {
|
||||
// entity = NULL;
|
||||
// }
|
||||
// else {
|
||||
// entity = sub_0805E768(); //Get empty entity
|
||||
// if (entity != NULL) {
|
||||
// (entity->entityType).type = type;
|
||||
// (entity->entityType).subtype = param_1->entitySubtype;
|
||||
// (entity->entityType).parameter1 = param_1->entityParameter1;
|
||||
// sub_0804AEB0(entity,param_1);
|
||||
// if ((param_1->field_0x1 & 240) != 16) {
|
||||
// (entity->entityType).parameter2 = *(u8 *)¶m_1->entityParameter2;
|
||||
// /* i suspect this is where the entity's behavior is defined. Not sure. */
|
||||
// entity->parameter3 = (u8)((u32)param_1->entityParameter2 >> 8);
|
||||
// if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) {
|
||||
// if ((param_1->entityType & 16) == 0) {
|
||||
// if ((param_1->entityType & 32) != 0) {
|
||||
// entity->collisionLayer = 2;
|
||||
// return entity;
|
||||
// }
|
||||
// if ((gRoomControls & 2) == 0) {
|
||||
// sub_08016A30(entity);
|
||||
// return entity;
|
||||
// }
|
||||
// }
|
||||
// entity->collisionLayer = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return entity;
|
||||
// }
|
||||
|
||||
+7
-8
@@ -1,22 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
|
||||
extern Entity * GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity *, u8);
|
||||
|
||||
Entity * CreateNPC(u32 subtype,u32 parameter1,u32 parameter2)
|
||||
Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2)
|
||||
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = GetEmptyEntity();
|
||||
if (pEVar1 != NULL) {
|
||||
(pEVar1->entityType).type = 7;
|
||||
(pEVar1->entityType).subtype = subtype;
|
||||
(pEVar1->entityType).parameter1 = parameter1;
|
||||
(pEVar1->entityType).parameter2 = parameter2;
|
||||
sub_0805EA2C(pEVar1,7);
|
||||
sub_0805EA2C(pEVar1, 7);
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,21 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity * GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity *,u8);
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
|
||||
Entity * CreateObject(u32 subtype,u32 param1,u32 param2)
|
||||
Entity* CreateObject(u32 subtype, u32 param1, u32 param2)
|
||||
|
||||
{
|
||||
Entity *newEnt;
|
||||
|
||||
Entity* newEnt;
|
||||
|
||||
newEnt = GetEmptyEntity();
|
||||
if (newEnt != NULL) {
|
||||
(newEnt->entityType).type = 6;
|
||||
(newEnt->entityType).subtype = subtype;
|
||||
(newEnt->entityType).parameter1 = param1;
|
||||
(newEnt->entityType).parameter2 = param2;
|
||||
sub_0805EA2C(newEnt,6);
|
||||
sub_0805EA2C(newEnt, 6);
|
||||
}
|
||||
return newEnt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity * CreateObject();
|
||||
extern Entity* CreateObject();
|
||||
extern void CopyPosition();
|
||||
|
||||
Entity * CreateObjectWithParent(Entity *parentEnt,u32 subtype,u32 param1, u32 param2)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 param1, u32 param2) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObject(subtype, param1, param2);
|
||||
if (ent != NULL) {
|
||||
ent->parent = parentEnt;
|
||||
CopyPosition(parentEnt,ent);
|
||||
CopyPosition(parentEnt, ent);
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
+9
-10
@@ -5,21 +5,20 @@ extern u32 gUnk_0813AD10;
|
||||
extern u32 gUnk_0813AD24;
|
||||
extern u32 gUnk_0813AD38;
|
||||
|
||||
extern void sub_0805E3A0(Entity *, u32);
|
||||
extern void sub_0807DD50(Entity *);
|
||||
extern void sub_0807DD94(Entity *, u32);
|
||||
extern void sub_08080840(u32 *);
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern void sub_08080840(u32*);
|
||||
|
||||
void sub_0806C550(Entity *param_1)
|
||||
void sub_0806C550(Entity* param_1)
|
||||
|
||||
{
|
||||
if (param_1->action == 0) {
|
||||
param_1->action += 1;
|
||||
sub_0805E3A0(param_1,2);
|
||||
sub_0805E3A0(param_1, 2);
|
||||
sub_0807DD50(param_1);
|
||||
}
|
||||
else {
|
||||
sub_0807DD94(param_1,0);
|
||||
} else {
|
||||
sub_0807DD94(param_1, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -43,4 +42,4 @@ void FUN_0806c598(void)
|
||||
{
|
||||
sub_08080840(&gUnk_0813AD38);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+58
-84
@@ -23,122 +23,96 @@ extern TextBox gTextBox;
|
||||
extern LinkState gLinkState;
|
||||
extern Entity gLinkEntity;
|
||||
|
||||
void sub_08065A64(Entity* ent);
|
||||
void sub_08065A64(Entity* this);
|
||||
|
||||
extern void (*gUnk_0811006C[])(Entity*);
|
||||
extern u64 gUnk_08110080[];
|
||||
|
||||
void sub_08065990(Entity* ent)
|
||||
{
|
||||
gUnk_0811006C[ent->action](ent);
|
||||
sub_08065A64(ent);
|
||||
sub_0806ED78(ent);
|
||||
void sub_08065990(Entity* this) {
|
||||
gUnk_0811006C[this->action](this);
|
||||
sub_08065A64(this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_080659B8(Entity* ent)
|
||||
{
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->animationState = 6;
|
||||
ent->field_0x69 = -1;
|
||||
ent->field_0x68 = sub_0801E99C(ent);
|
||||
LoadAnimation(ent, ent->animationState / 2);
|
||||
void sub_080659B8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->animationState = 6;
|
||||
this->field_0x69 = -1;
|
||||
this->field_0x68 = sub_0801E99C(this);
|
||||
LoadAnimation(this, this->animationState / 2);
|
||||
}
|
||||
|
||||
void sub_080659F0(Entity* ent)
|
||||
{
|
||||
sub_080042B8(ent);
|
||||
sub_08065AA4(ent);
|
||||
void sub_080659F0(Entity* this) {
|
||||
sub_080042B8(this);
|
||||
sub_08065AA4(this);
|
||||
}
|
||||
|
||||
void sub_08065A00(Entity* ent)
|
||||
{
|
||||
sub_080042B8(ent);
|
||||
sub_08065AA4(ent);
|
||||
void sub_08065A00(Entity* this) {
|
||||
sub_080042B8(this);
|
||||
sub_08065AA4(this);
|
||||
}
|
||||
|
||||
void sub_08065A10(Entity* ent)
|
||||
{
|
||||
if ((gTextBox.doTextBox & 0x7F) == 0)
|
||||
{
|
||||
ent->action = 1;
|
||||
LoadAnimation(ent, ent->animationState / 2);
|
||||
void sub_08065A10(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7F) == 0) {
|
||||
this->action = 1;
|
||||
LoadAnimation(this, this->animationState / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065A34(Entity* ent)
|
||||
{
|
||||
if (UpdateFuseInteraction() != 0)
|
||||
{
|
||||
ent->action = 1;
|
||||
LoadAnimation(ent, ent->animationState / 2);
|
||||
void sub_08065A34(Entity* this) {
|
||||
if (UpdateFuseInteraction() != 0) {
|
||||
this->action = 1;
|
||||
LoadAnimation(this, this->animationState / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065A50(Entity* ent)
|
||||
{
|
||||
ShowNPCDialogue(ent, &gUnk_08110080[ent->entityType.parameter1]);
|
||||
void sub_08065A50(Entity* this) {
|
||||
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.parameter1]);
|
||||
}
|
||||
|
||||
void sub_08065A64(Entity* ent)
|
||||
{
|
||||
void sub_08065A64(Entity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
|
||||
uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f;
|
||||
if (uVar2 != ent->field_0x69)
|
||||
{
|
||||
if (uVar2 == 0)
|
||||
{
|
||||
sub_08078778(ent);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_080787A8(ent, ent->field_0x68);
|
||||
if (uVar2 != this->field_0x69) {
|
||||
if (uVar2 == 0) {
|
||||
sub_08078778(this);
|
||||
} else {
|
||||
sub_080787A8(this, this->field_0x68);
|
||||
}
|
||||
}
|
||||
ent->field_0x69 = uVar2;
|
||||
this->field_0x69 = uVar2;
|
||||
}
|
||||
|
||||
void sub_08065AA4(Entity* ent)
|
||||
{
|
||||
if (ent->interactType != 0)
|
||||
{
|
||||
if (gLinkState.flags.all & 0x80)
|
||||
{
|
||||
if (ent->interactType == 2)
|
||||
{
|
||||
ent->action = 4;
|
||||
sub_0806F118(ent);
|
||||
void sub_08065AA4(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
if (gLinkState.flags.all & 0x80) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
this->action = 3;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_08065A50(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->action = 3;
|
||||
sub_0805E3A0(ent, 2);
|
||||
sub_08065A50(ent);
|
||||
}
|
||||
sub_080045C4(ent, &gLinkEntity);
|
||||
LoadAnimation(ent, sub_0806F5A4());
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_08065A50(ent);
|
||||
sub_080045C4(this, &gLinkEntity);
|
||||
LoadAnimation(this, sub_0806F5A4());
|
||||
} else {
|
||||
sub_08065A50(this);
|
||||
sub_080791D0();
|
||||
}
|
||||
PlaySFX(0xD3);
|
||||
ent->interactType = 0;
|
||||
this->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065B1C(Entity* ent)
|
||||
{
|
||||
if (ent->action == 0)
|
||||
{
|
||||
ent->action += 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
LoadAnimation(ent, 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_080042B8(ent);
|
||||
void sub_08065B1C(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action += 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
LoadAnimation(this, 7);
|
||||
} else {
|
||||
sub_080042B8(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
u32 extern CheckLocalFlagByOffset(u32, u32);
|
||||
|
||||
u32 CheckGlobalFlag (u32 index) {
|
||||
return CheckLocalFlagByOffset(0, index);
|
||||
}
|
||||
u32 CheckGlobalFlag(u32 index) {
|
||||
return CheckLocalFlagByOffset(0, index);
|
||||
}
|
||||
|
||||
+7
-10
@@ -9,10 +9,8 @@ extern RoomControls gRoomControls;
|
||||
extern s16 gUnk_08121750[];
|
||||
extern s16 gUnk_0812176A[];
|
||||
|
||||
void sub_0808D5DC(Entity* ent)
|
||||
{
|
||||
if (ent->action == 0)
|
||||
{
|
||||
void sub_0808D5DC(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->spriteOrder.b3 = 3;
|
||||
@@ -22,17 +20,16 @@ void sub_0808D5DC(Entity* ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808D618(Entity *ent)
|
||||
{
|
||||
void sub_0808D618(Entity* ent) {
|
||||
u32 tilePos;
|
||||
s16 *arr;
|
||||
s16* arr;
|
||||
u32 i;
|
||||
|
||||
arr = (ent->entityType.parameter1 != 0) ? gUnk_0812176A : gUnk_08121750;
|
||||
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);
|
||||
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) |
|
||||
((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);
|
||||
|
||||
for (i = 0; i < 13; i++)
|
||||
{
|
||||
for (i = 0; i < 13; i++) {
|
||||
SetTile(16500, tilePos + arr[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
+155
-244
@@ -4,11 +4,10 @@
|
||||
#include "screen.h"
|
||||
#include "greatFairy.h"
|
||||
|
||||
//Main
|
||||
void sub_08086A90(Entity *ent)
|
||||
{
|
||||
// Main
|
||||
void sub_08086A90(Entity* ent) {
|
||||
u8 bVar1;
|
||||
|
||||
|
||||
if (ent->action == 0) {
|
||||
bVar1 = __modsi3((ent->entityType).parameter1, 11);
|
||||
(ent->entityType).parameter2 = bVar1;
|
||||
@@ -16,38 +15,33 @@ void sub_08086A90(Entity *ent)
|
||||
gGreatFairy[(ent->entityType).parameter2](ent);
|
||||
}
|
||||
|
||||
//Behaviors
|
||||
void sub_08086ABC(Entity *ent)
|
||||
{
|
||||
// Behaviors
|
||||
void sub_08086ABC(Entity* ent) {
|
||||
gGreatFairyBehaviors[ent->action](ent);
|
||||
|
||||
|
||||
if ((gLinkEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) {
|
||||
|
||||
|
||||
gRoomControls.cameraTarget = ent;
|
||||
gRoomControls.unk5 = 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gRoomControls.cameraTarget = &gLinkEntity;
|
||||
gRoomControls.unk5 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//Init
|
||||
void sub_08086AF8(Entity *ent)
|
||||
{
|
||||
// Init
|
||||
void sub_08086AF8(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->parameter3 = 0;
|
||||
ent->cutsceneBeh.HWORD = 290;
|
||||
}
|
||||
|
||||
//Dormant update
|
||||
void sub_08086B10(Entity *ent)
|
||||
{
|
||||
u16 *pFrame; // r1@2
|
||||
s32 frame; // r1@4
|
||||
Entity *ripple; // r5@16
|
||||
u32 event;
|
||||
// Dormant update
|
||||
void sub_08086B10(Entity* ent) {
|
||||
u16* pFrame; // r1@2
|
||||
s32 frame; // r1@4
|
||||
Entity* ripple; // r5@16
|
||||
u32 event;
|
||||
|
||||
event = CheckRoomFlag(0);
|
||||
if (event == 0) {
|
||||
@@ -59,68 +53,52 @@ void sub_08086B10(Entity *ent)
|
||||
}
|
||||
frame = *pFrame;
|
||||
|
||||
if ( frame == 0x96 )
|
||||
{
|
||||
if (frame == 0x96) {
|
||||
goto LABEL_16;
|
||||
}
|
||||
|
||||
if ( frame < 0x97 )
|
||||
{
|
||||
if (frame != 0)
|
||||
{
|
||||
if ( frame == 0x82 )
|
||||
{
|
||||
|
||||
if (frame < 0x97) {
|
||||
if (frame != 0) {
|
||||
if (frame == 0x82) {
|
||||
goto LABEL_16;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
goto LABEL_17;
|
||||
}
|
||||
else {
|
||||
if (frame == 0xd2)
|
||||
{
|
||||
} else {
|
||||
if (frame == 0xd2) {
|
||||
goto LABEL_16;
|
||||
}
|
||||
if (frame < 0xd3)
|
||||
{
|
||||
if (frame == 0xaa)
|
||||
{
|
||||
if (frame < 0xd3) {
|
||||
if (frame == 0xaa) {
|
||||
goto LABEL_16;
|
||||
}
|
||||
else return;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
if ( frame == 289 )
|
||||
{
|
||||
if (frame == 289) {
|
||||
goto LABEL_16;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LABEL_17:
|
||||
ent->action = 2;
|
||||
return;
|
||||
ent->action = 2;
|
||||
return;
|
||||
LABEL_16:
|
||||
ripple = sub_080873AC(ent, 6, 0);
|
||||
if ( ripple )
|
||||
{
|
||||
PositionRelative(
|
||||
ent,
|
||||
ripple,
|
||||
(s32)gGreatFairyRippleOffsets[ent->parameter3] << 16,
|
||||
(s32)gGreatFairyRippleOffsets[ent->parameter3 + 1] << 16);
|
||||
if (ripple) {
|
||||
PositionRelative(ent, ripple, (s32)gGreatFairyRippleOffsets[ent->parameter3] << 16,
|
||||
(s32)gGreatFairyRippleOffsets[ent->parameter3 + 1] << 16);
|
||||
ent->parameter3 += 2;
|
||||
}
|
||||
}
|
||||
|
||||
//Create Great Fairy
|
||||
void sub_08086BA0(Entity *ent)
|
||||
{
|
||||
Entity *gf;
|
||||
|
||||
// Create Great Fairy
|
||||
void sub_08086BA0(Entity* ent) {
|
||||
Entity* gf;
|
||||
|
||||
gf = sub_080873AC(ent, 7, 0);
|
||||
if (gf != NULL) {
|
||||
PositionRelative(ent, gf, 0, 0x80000);
|
||||
@@ -128,17 +106,14 @@ void sub_08086BA0(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Great Fairy spawn-in update
|
||||
void sub_08086BC4(Entity *ent)
|
||||
{
|
||||
Entity *mini;
|
||||
// Great Fairy spawn-in update
|
||||
void sub_08086BC4(Entity* ent) {
|
||||
Entity* mini;
|
||||
u32 var;
|
||||
|
||||
if (gRoomVars.greatFairyState & 1)
|
||||
{
|
||||
if (gRoomVars.greatFairyState & 1) {
|
||||
mini = sub_080873AC(ent, 2, 0);
|
||||
if (mini != NULL)
|
||||
{
|
||||
if (mini != NULL) {
|
||||
CopyPosition(ent, mini);
|
||||
DoFade(6, 4);
|
||||
PlaySFX(325);
|
||||
@@ -150,20 +125,16 @@ void sub_08086BC4(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Mini Great Fairy update
|
||||
void sub_08086C18(Entity *ent)
|
||||
{
|
||||
Entity *target;
|
||||
|
||||
// Mini Great Fairy update
|
||||
void sub_08086C18(Entity* ent) {
|
||||
Entity* target;
|
||||
|
||||
sub_08004274(ent);
|
||||
if (ent->parameter3 != 0)
|
||||
{
|
||||
if (ent->parameter3 != 0) {
|
||||
ent->parameter3 = ent->parameter3 - 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
target = sub_080873AC(ent, 1, 0);
|
||||
if (target != NULL)
|
||||
{
|
||||
if (target != NULL) {
|
||||
PositionRelative(ent, target, 0, -0x140000);
|
||||
ent->action = 5;
|
||||
ent->parameter3 = 120;
|
||||
@@ -172,19 +143,14 @@ void sub_08086C18(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Final Great Fairy update
|
||||
void sub_08086C58(Entity *ent)
|
||||
{
|
||||
Entity *target;
|
||||
|
||||
if (ent->parameter3 != 0)
|
||||
{
|
||||
// Final Great Fairy update
|
||||
void sub_08086C58(Entity* ent) {
|
||||
Entity* target;
|
||||
|
||||
if (ent->parameter3 != 0) {
|
||||
ent->parameter3 = ent->parameter3 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ent->field_0xf == 0) && (target = sub_080873AC(ent, 9, 0), target != NULL))
|
||||
{
|
||||
} else {
|
||||
if ((ent->field_0xf == 0) && (target = sub_080873AC(ent, 9, 0), target != NULL)) {
|
||||
PositionRelative(ent, target, 0, -0x4C0000);
|
||||
target->parent = ent;
|
||||
ent->field_0xf = 1;
|
||||
@@ -193,14 +159,12 @@ void sub_08086C58(Entity *ent)
|
||||
sub_08004274(ent);
|
||||
}
|
||||
|
||||
//Wings
|
||||
void sub_08086C9C(Entity *ent)
|
||||
{
|
||||
// Wings
|
||||
void sub_08086C9C(Entity* ent) {
|
||||
gGreatFairyWings[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_08086CB4(Entity *ent)
|
||||
{
|
||||
void sub_08086CB4(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->ticks.b0 = 5;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
@@ -211,11 +175,10 @@ void sub_08086CB4(Entity *ent)
|
||||
sub_0805EC9C(ent, 1024, 256, 0);
|
||||
}
|
||||
|
||||
//Wings init
|
||||
void sub_08086D18(Entity *ent)
|
||||
{
|
||||
// Wings init
|
||||
void sub_08086D18(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
|
||||
iVar1 = (u16)ent->nonPlanarMovement - 32;
|
||||
ent->nonPlanarMovement = (short)iVar1;
|
||||
if (iVar1 * 65536 >> 16 == 256) {
|
||||
@@ -223,47 +186,40 @@ void sub_08086D18(Entity *ent)
|
||||
sub_0805EC60(ent);
|
||||
gRoomVars.greatFairyState = gRoomVars.greatFairyState | 32;
|
||||
gUnk_02033280 = gUnk_02033280 | 4;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sub_0805EC9C(ent, ent->nonPlanarMovement, 256, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_116(void)
|
||||
{
|
||||
void nullsub_116(void) {
|
||||
}
|
||||
|
||||
//Wake
|
||||
void sub_08086D6C(Entity *ent)
|
||||
{
|
||||
// Wake
|
||||
void sub_08086D6C(Entity* ent) {
|
||||
gGreatFairyWake[ent->action](ent);
|
||||
}
|
||||
|
||||
//Wake init
|
||||
void sub_08086D84(Entity *ent)
|
||||
{
|
||||
// Wake init
|
||||
void sub_08086D84(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->ticks.b0 = 6;
|
||||
}
|
||||
|
||||
//Wake update
|
||||
void sub_08086DAC(Entity *ent)
|
||||
{
|
||||
// Wake update
|
||||
void sub_08086DAC(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
}
|
||||
|
||||
//Mini great fairy
|
||||
void sub_08086DB4(Entity *ent)
|
||||
{
|
||||
// Mini great fairy
|
||||
void sub_08086DB4(Entity* ent) {
|
||||
gGreatFairyMini[ent->action](ent);
|
||||
}
|
||||
|
||||
//Mini great fairy init
|
||||
void sub_08086DCC(Entity *ent)
|
||||
{
|
||||
Entity *wake;
|
||||
|
||||
// Mini great fairy init
|
||||
void sub_08086DCC(Entity* ent) {
|
||||
Entity* wake;
|
||||
|
||||
wake = sub_080873AC(ent, 4, 0);
|
||||
if (wake != NULL) {
|
||||
CopyPosition(ent, wake);
|
||||
@@ -274,28 +230,25 @@ void sub_08086DCC(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Mini great fairy pre-drip
|
||||
void sub_08086E04(Entity *ent)
|
||||
{
|
||||
Entity *target;
|
||||
|
||||
// Mini great fairy pre-drip
|
||||
void sub_08086E04(Entity* ent) {
|
||||
Entity* target;
|
||||
|
||||
sub_08004274(ent);
|
||||
ent->height.WORD = ent->height.WORD + -32768;
|
||||
ent->height.WORD = ent->height.WORD + -0x8000;
|
||||
if (ent->height.HALF.HI == -20) {
|
||||
ent->action = 2;
|
||||
PlaySFX(321);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (((ent->height.HALF.HI == -10) && (ent->field_0xf == 0)) &&
|
||||
(target = sub_080873AC(ent, 5, 0), target != NULL)) {
|
||||
(target = sub_080873AC(ent, 5, 0), target != NULL)) {
|
||||
PositionRelative(ent, target, 0, 0x40000);
|
||||
ent->field_0xf = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08086E64(Entity *ent)
|
||||
{
|
||||
void sub_08086E64(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
sub_080873D0(ent);
|
||||
if ((gRoomVars.greatFairyState & 1) != 0) {
|
||||
@@ -303,26 +256,23 @@ void sub_08086E64(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Mini great fairy behaviors
|
||||
void sub_08086E8C(Entity *ent)
|
||||
{
|
||||
// Mini great fairy behaviors
|
||||
void sub_08086E8C(Entity* ent) {
|
||||
gGreatFairyMiniAnim[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_08086EA4(Entity *ent)
|
||||
{
|
||||
void sub_08086EA4(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->ticks.b0 = 6;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
}
|
||||
|
||||
//Mini great fairy translate
|
||||
void sub_08086ED0(Entity *ent)
|
||||
{
|
||||
Entity *parent = ent->parent;
|
||||
// Mini great fairy translate
|
||||
void sub_08086ED0(Entity* ent) {
|
||||
Entity* parent = ent->parent;
|
||||
|
||||
CopyPosition(parent, ent);
|
||||
|
||||
|
||||
if (ent->height.HALF.HI == -20) {
|
||||
ent->action = 2;
|
||||
ent->parameter3 = 90;
|
||||
@@ -332,35 +282,28 @@ void sub_08086ED0(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
//Mini great fairy stretch
|
||||
void sub_08086F10(Entity *ent)
|
||||
{
|
||||
u32 bVar1;
|
||||
// Mini great fairy stretch
|
||||
void sub_08086F10(Entity* ent) {
|
||||
s32 iVar2;
|
||||
|
||||
bVar1 = ent->parameter3 -= 1;
|
||||
|
||||
if (bVar1 == 0) {
|
||||
if (--ent->parameter3 == 0) {
|
||||
gRoomVars.greatFairyState = gRoomVars.greatFairyState | 1;
|
||||
ent->action = 3;
|
||||
sub_0805EC60(ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
iVar2 = (u16)ent->nonPlanarMovement - 24;
|
||||
ent->nonPlanarMovement = iVar2;
|
||||
sub_0805EC9C(ent, 256, iVar2 * 65536 >> 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//Drip
|
||||
void sub_08086F54(Entity *ent)
|
||||
{
|
||||
// Drip
|
||||
void sub_08086F54(Entity* ent) {
|
||||
gGreatFairyDrip[ent->action](ent);
|
||||
}
|
||||
|
||||
//Drip init
|
||||
void sub_08086F6C(Entity *ent)
|
||||
{
|
||||
// Drip init
|
||||
void sub_08086F6C(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->height.HALF.HI = 0;
|
||||
@@ -368,49 +311,42 @@ void sub_08086F6C(Entity *ent)
|
||||
PlaySFX(320);
|
||||
}
|
||||
|
||||
//Drip update
|
||||
void sub_08086FA0(Entity *ent)
|
||||
{
|
||||
// Drip update
|
||||
void sub_08086FA0(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
if ((ent->frames.all & 128) != 0) {
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
//Ripple
|
||||
void sub_08086FC0(Entity *ent)
|
||||
{
|
||||
// Ripple
|
||||
void sub_08086FC0(Entity* ent) {
|
||||
gGreatFairyRipple[ent->action](ent);
|
||||
}
|
||||
|
||||
//Ripple init
|
||||
void sub_08086FD8(Entity *ent)
|
||||
{
|
||||
// Ripple init
|
||||
void sub_08086FD8(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->ticks.b0 = 6;
|
||||
}
|
||||
|
||||
//Ripple update
|
||||
void sub_08087000(Entity *ent)
|
||||
{
|
||||
// Ripple update
|
||||
void sub_08087000(Entity* ent) {
|
||||
if ((gRoomVars.greatFairyState & 2) != 0) {
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sub_08004274(ent);
|
||||
}
|
||||
}
|
||||
|
||||
//Big ripple
|
||||
void sub_08087024(Entity *ent)
|
||||
{
|
||||
// Big ripple
|
||||
void sub_08087024(Entity* ent) {
|
||||
gGreatFairyBigRipple[ent->action](ent);
|
||||
}
|
||||
|
||||
//Big ripple init
|
||||
void sub_0808703C(Entity *ent)
|
||||
{
|
||||
// Big ripple init
|
||||
void sub_0808703C(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->parameter3 = 120;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
@@ -418,63 +354,54 @@ void sub_0808703C(Entity *ent)
|
||||
PlaySFX(249);
|
||||
}
|
||||
|
||||
//Big ripple update
|
||||
void sub_0808706C(Entity *ent)
|
||||
{
|
||||
Entity *target;
|
||||
|
||||
// Big ripple update
|
||||
void sub_0808706C(Entity* ent) {
|
||||
Entity* target;
|
||||
|
||||
sub_08004274(ent);
|
||||
if (ent->parameter3 != 0) {
|
||||
ent->parameter3 = ent->parameter3 - 1;
|
||||
}
|
||||
else {
|
||||
target = sub_080873AC(ent,3,0);
|
||||
ent->parameter3--;
|
||||
} else {
|
||||
target = sub_080873AC(ent, 3, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(ent,target,0,-524288);
|
||||
PositionRelative(ent, target, 0, -0x80000);
|
||||
gRoomVars.greatFairyState = gRoomVars.greatFairyState | 2;
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Energy
|
||||
void GreatFairyEnergy(Entity *ent)
|
||||
{
|
||||
// Energy
|
||||
void GreatFairyEnergy(Entity* ent) {
|
||||
gGreatFairyEnergy[ent->action](ent);
|
||||
}
|
||||
|
||||
//Energy init
|
||||
void sub_080870CC(Entity *ent)
|
||||
{
|
||||
// Energy init
|
||||
void sub_080870CC(Entity* ent) {
|
||||
sub_08087380();
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->ticks.b0 = 5;
|
||||
}
|
||||
|
||||
//Energy update
|
||||
void sub_080870F4(Entity *ent)
|
||||
{
|
||||
// Energy update
|
||||
void sub_080870F4(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
if ((ent->frames.all & 128) != 0) {
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_08087114(Entity *ent)
|
||||
{
|
||||
void sub_08087114(Entity* ent) {
|
||||
if ((ent->entityType).parameter2 == 0) {
|
||||
gGreatFairyInteract1[ent->action](ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gGreatFairyInteract2[ent->action](ent);
|
||||
sub_08004274(ent);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_08087150(Entity *ent)
|
||||
{
|
||||
void sub_08087150(Entity* ent) {
|
||||
u8 var;
|
||||
u32 var2;
|
||||
|
||||
@@ -490,22 +417,19 @@ void sub_08087150(Entity *ent)
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08087150(Entity *ent)
|
||||
{
|
||||
asm(".include \"asm/greatFairy/sub_08087150.inc\"");
|
||||
void sub_08087150(Entity* ent) {
|
||||
asm(".include \"asm/greatFairy/sub_08087150.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void nullsub_516()
|
||||
{
|
||||
void nullsub_516() {
|
||||
}
|
||||
|
||||
void sub_080871A8(Entity *ent)
|
||||
{
|
||||
void sub_080871A8(Entity* ent) {
|
||||
u32 bVar1;
|
||||
|
||||
|
||||
bVar1 = ent->parameter3 -= 1;
|
||||
|
||||
|
||||
if (bVar1 == 0) {
|
||||
ent->action = 3;
|
||||
ent->parameter3 = 60;
|
||||
@@ -513,10 +437,9 @@ void sub_080871A8(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080871D0(Entity *ent)
|
||||
{
|
||||
void sub_080871D0(Entity* ent) {
|
||||
u8 bVar1;
|
||||
|
||||
|
||||
bVar1 = ent->parameter3 -= 1;
|
||||
if (bVar1 == 0) {
|
||||
gRoomVars.greatFairyState = gRoomVars.greatFairyState | 8;
|
||||
@@ -525,15 +448,13 @@ void sub_080871D0(Entity *ent)
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_080871F8(Entity *ent)
|
||||
{
|
||||
void sub_080871F8(Entity* ent) {
|
||||
s32 bVar1;
|
||||
|
||||
if ((( ent->attachedEntity->x.HALF.HI == (ent->x).HALF.HI) &&
|
||||
((Entity *)ent->attachedEntity)->y.HALF.HI + -32 == (ent->y).HALF.HI)) {
|
||||
|
||||
if (((ent->attachedEntity->x.HALF.HI == (ent->x).HALF.HI) &&
|
||||
((Entity*)ent->attachedEntity)->y.HALF.HI + -32 == (ent->y).HALF.HI)) {
|
||||
ent->action = 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
bVar1 = (ent->x).HALF.HI;
|
||||
sub_080045D4();
|
||||
ent->direction = bVar1;
|
||||
@@ -542,14 +463,12 @@ void sub_080871F8(Entity *ent)
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_080871F8(Entity *ent)
|
||||
{
|
||||
asm(".include \"asm/greatFairy/sub_080871F8.inc\"");
|
||||
void sub_080871F8(Entity* ent) {
|
||||
asm(".include \"asm/greatFairy/sub_080871F8.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08087240(Entity *ent)
|
||||
{
|
||||
void sub_08087240(Entity* ent) {
|
||||
if ((gRoomVars.greatFairyState & 4) != 0) {
|
||||
ent->action = 3;
|
||||
ent->parameter3 = 20;
|
||||
@@ -557,32 +476,26 @@ void sub_08087240(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087264(Entity *ent)
|
||||
{
|
||||
void sub_08087264(Entity* ent) {
|
||||
if (ent->parameter3 != 0) {
|
||||
ent->parameter3 = ent->parameter3 - 1;
|
||||
ent->parameter3--;
|
||||
sub_0806F69C(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808727C(Entity *ent)
|
||||
{
|
||||
u8 bVar1;
|
||||
|
||||
bVar1 = ent->parameter3 -= 1;
|
||||
if (bVar1 == 0) {
|
||||
void sub_0808727C(Entity* ent) {
|
||||
|
||||
if (--ent->parameter3 == 0) {
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087294(Entity *ent)
|
||||
{
|
||||
void sub_08087294(Entity* ent) {
|
||||
gUnk_081207A4[ent->action](ent);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_080872AC(Entity *ent)
|
||||
{
|
||||
void sub_080872AC(Entity* ent) {
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->spriteOrientation.b2 = 1;
|
||||
ent->spriteOrder.b0 = 0;
|
||||
@@ -594,9 +507,7 @@ void sub_080872AC(Entity *ent)
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_080872AC(Entity *ent)
|
||||
{
|
||||
asm(".include \"asm/greatFairy/sub_080872AC.inc\"");
|
||||
void sub_080872AC(Entity* ent) {
|
||||
asm(".include \"asm/greatFairy/sub_080872AC.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,17 +13,16 @@ typedef struct {
|
||||
} TransitionStruct;
|
||||
|
||||
extern u32 DoFade(u32, u32);
|
||||
extern void sub_0801D630(u32 *, u32, u32);
|
||||
extern void sub_0801D630(u32*, u32, u32);
|
||||
extern u32 gUnk_02000080;
|
||||
extern TransitionStruct gUnk_03001000;
|
||||
extern Menu gUnk_02032EC0;
|
||||
|
||||
|
||||
u32 IntroSetTransition(u8 transition,u32 param_2,u32 param_3)
|
||||
u32 IntroSetTransition(u8 transition, u32 param_2, u32 param_3)
|
||||
|
||||
{
|
||||
gUnk_02032EC0.transitionType = transition;
|
||||
gUnk_03001000.functionIndex = 2;
|
||||
sub_0801D630(&gUnk_02000080,48,param_3);
|
||||
return DoFade(7,8);
|
||||
sub_0801D630(&gUnk_02000080, 48, param_3);
|
||||
return DoFade(7, 8);
|
||||
}
|
||||
|
||||
+18
-18
@@ -1,32 +1,32 @@
|
||||
#include "global.h"
|
||||
/* called when loading any room */
|
||||
|
||||
void LoadRoomEntityList();
|
||||
s32 CheckGlobalFlag(u32 flag);
|
||||
extern s32* sub_0804B128(u8 unk);
|
||||
extern void sub_0804B058(s32 *unk);
|
||||
extern void sub_0804B1AC();
|
||||
extern void sub_0801AC98();
|
||||
void LoadRoomEntityList();
|
||||
s32 CheckGlobalFlag(u32 flag);
|
||||
extern s32* sub_0804B128(u8 unk);
|
||||
extern void sub_0804B058(s32* unk);
|
||||
extern void sub_0804B1AC();
|
||||
extern void sub_0801AC98();
|
||||
|
||||
void LoadRoom(void)
|
||||
|
||||
{
|
||||
|
||||
s32 iVar1;
|
||||
s32 *dat;
|
||||
s32* dat;
|
||||
|
||||
sub_0804B128(1);
|
||||
LoadRoomEntityList();
|
||||
sub_0804B128(0);
|
||||
LoadRoomEntityList();
|
||||
|
||||
sub_0804B128(1);
|
||||
LoadRoomEntityList();
|
||||
sub_0804B128(0);
|
||||
LoadRoomEntityList();
|
||||
|
||||
iVar1 = CheckGlobalFlag(21);
|
||||
if (iVar1 != 0) {
|
||||
dat = sub_0804B128(2);
|
||||
sub_0804B058(dat);
|
||||
dat = sub_0804B128(2);
|
||||
sub_0804B058(dat);
|
||||
}
|
||||
sub_0804B128(3);
|
||||
sub_0804B1AC();
|
||||
sub_0801AC98();
|
||||
sub_0804B128(3);
|
||||
sub_0804B1AC();
|
||||
sub_0801AC98();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "entityData.h"
|
||||
|
||||
void extern CreateEntity(EntityData *);
|
||||
void extern CreateEntity(EntityData*);
|
||||
|
||||
void LoadRoomEntityList(EntityData *listPtr) {
|
||||
if (listPtr != NULL) {
|
||||
while (listPtr->entityType != 0xFF) {
|
||||
CreateEntity(listPtr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
void LoadRoomEntityList(EntityData* listPtr) {
|
||||
if (listPtr != NULL) {
|
||||
while (listPtr->entityType != 0xFF) {
|
||||
CreateEntity(listPtr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-26
@@ -1,25 +1,24 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void sub_0806ED78(Entity *);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void LoadAnimation();
|
||||
extern void sub_08063280();
|
||||
extern void TextboxTryNoOverlap(u32);
|
||||
extern void sub_080042B8();
|
||||
extern void CreateFx();
|
||||
|
||||
extern void (*gMailboxBehaviors[4])(Entity *);
|
||||
extern void (*gMailboxBehaviors[4])(Entity*);
|
||||
|
||||
void sub_080631E8(Entity *ent)
|
||||
{
|
||||
void sub_080631E8(Entity* ent) {
|
||||
gMailboxBehaviors[ent->action](ent);
|
||||
|
||||
|
||||
if (ent->action != 0) {
|
||||
sub_0806ED78(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063210(Entity *ent)
|
||||
void sub_08063210(Entity* ent)
|
||||
|
||||
{
|
||||
ent->action = 1;
|
||||
@@ -27,29 +26,26 @@ void sub_08063210(Entity *ent)
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08063220(Entity *ent)
|
||||
void sub_08063220(Entity* ent)
|
||||
|
||||
{
|
||||
u8 bVar1;
|
||||
|
||||
|
||||
if (ent->interactType != 0) {
|
||||
ent->action = 2;
|
||||
bVar1 = 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
bVar1 = 0;
|
||||
}
|
||||
|
||||
|
||||
if (ent->field_0x58 != bVar1) {
|
||||
LoadAnimation(ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sub_08063280(ent, bVar1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sub_08063254(Entity *ent)
|
||||
void sub_08063254(Entity* ent)
|
||||
|
||||
{
|
||||
sub_08063280(ent);
|
||||
@@ -60,23 +56,23 @@ void sub_08063254(Entity *ent)
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08063278(Entity *ent)
|
||||
void sub_08063278(Entity* ent)
|
||||
|
||||
{
|
||||
sub_08063280(ent);
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08063280(Entity *ent)
|
||||
void sub_08063280(Entity* ent)
|
||||
|
||||
{
|
||||
Entity *e; // r4@1
|
||||
u8 var; // r2@1
|
||||
Entity* e; // r4@1
|
||||
u8 var; // r2@1
|
||||
|
||||
e = ent;
|
||||
sub_080042B8();
|
||||
var = e->frames.all & 0x7F;
|
||||
e->frames.all = e->frames.all ^ var;
|
||||
if ( var == 2 )
|
||||
CreateFx(e, 49, 0);
|
||||
}
|
||||
e = ent;
|
||||
sub_080042B8();
|
||||
var = e->frames.all & 0x7F;
|
||||
e->frames.all = e->frames.all ^ var;
|
||||
if (var == 2)
|
||||
CreateFx(e, 49, 0);
|
||||
}
|
||||
|
||||
+10
-12
@@ -30,7 +30,7 @@ extern void sub_0804FFE4(void);
|
||||
extern void sub_0804FF84(u32);
|
||||
extern void sub_08056418(void);
|
||||
extern void sub_080ADD30(void);
|
||||
extern void sub_0801D630(void *,u32);
|
||||
extern void sub_0801D630(void*, u32);
|
||||
extern void sub_08056010(u32);
|
||||
extern void ReadKeyInput();
|
||||
extern u32 sub_08055FF4();
|
||||
@@ -45,15 +45,14 @@ extern u8 gUnk_02000014;
|
||||
extern u32 gUnk_020176A0;
|
||||
extern u32 gRand;
|
||||
extern MainStruct gUnk_03001000;
|
||||
extern void (* gUnk_08100CBC[])();
|
||||
extern void (*gUnk_08100CBC[])();
|
||||
extern void VBlankInterruptWait(void);
|
||||
|
||||
void MainLoop(void)
|
||||
{
|
||||
void MainLoop(void) {
|
||||
bool32 codeInputted;
|
||||
u8 cVar1;
|
||||
u32 uVar2;
|
||||
|
||||
|
||||
sub_08055F70();
|
||||
sub_080A3204();
|
||||
sub_0805616C();
|
||||
@@ -62,12 +61,12 @@ void MainLoop(void)
|
||||
sub_08056208();
|
||||
gUnk_02000014 = 193;
|
||||
sub_0804FFE4();
|
||||
DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U);
|
||||
DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U);
|
||||
sub_0804FF84(1);
|
||||
sub_08056418();
|
||||
sub_080ADD30();
|
||||
gRand = 0x1234567;
|
||||
sub_0801D630(&gUnk_03001000,16);
|
||||
sub_0801D630(&gUnk_03001000, 16);
|
||||
sub_08056010(0);
|
||||
do {
|
||||
ReadKeyInput();
|
||||
@@ -97,16 +96,15 @@ void MainLoop(void)
|
||||
sub_08056458();
|
||||
sub_08050154();
|
||||
sub_080A3480();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sub_08056260();
|
||||
}
|
||||
sub_08016E78();
|
||||
} while( TRUE );
|
||||
} while (TRUE);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void MainLoop(void) {
|
||||
asm(".include \"asm/non_matching/mainLoop.inc\"");
|
||||
asm(".include \"asm/non_matching/mainLoop.inc\"");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+5
-10
@@ -1,22 +1,19 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void _call_via_r1(Entity *, u32);
|
||||
extern void _call_via_r1(Entity*, u32);
|
||||
extern void sub_0806ED78();
|
||||
extern void LoadAnimation();
|
||||
extern void sub_080042B8();
|
||||
|
||||
extern void (*gMilkCartBehaviors[2])(Entity*);
|
||||
|
||||
void sub_08065B4C(Entity *ent)
|
||||
{
|
||||
void sub_08065B4C(Entity* ent) {
|
||||
gMilkCartBehaviors[ent->action](ent);
|
||||
sub_0806ED78(ent);
|
||||
}
|
||||
|
||||
|
||||
void sub_08065B6C(Entity *ent)
|
||||
{
|
||||
void sub_08065B6C(Entity* ent) {
|
||||
ent->action++;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
(ent->y).HALF.LO += -32768;
|
||||
@@ -24,8 +21,6 @@ void sub_08065B6C(Entity *ent)
|
||||
LoadAnimation(ent, 3);
|
||||
}
|
||||
|
||||
|
||||
void sub_08065B9C(Entity *ent)
|
||||
{
|
||||
void sub_08065B9C(Entity* ent) {
|
||||
sub_080042B8(ent);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ s32 ModHealth(s32 deltaHealth)
|
||||
|
||||
{
|
||||
s32 newHealth;
|
||||
|
||||
|
||||
newHealth = gStats.health + deltaHealth;
|
||||
if (newHealth < 0) {
|
||||
newHealth = 0;
|
||||
@@ -17,4 +17,4 @@ s32 ModHealth(s32 deltaHealth)
|
||||
gStats.health = newHealth;
|
||||
gLinkEntity.currentHealth = newHealth;
|
||||
return newHealth;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -7,16 +7,15 @@ void ModRupees(s32 rupeeDelta)
|
||||
|
||||
{
|
||||
s32 newRupeeCount;
|
||||
Stats *s = &gStats;
|
||||
Stats* s = &gStats;
|
||||
|
||||
newRupeeCount = s->rupees + rupeeDelta;
|
||||
if (newRupeeCount < 0) {
|
||||
newRupeeCount = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (newRupeeCount > gWalletSizes[s->walletType * 2]) {
|
||||
newRupeeCount = gWalletSizes[s->walletType * 2];
|
||||
}
|
||||
}
|
||||
s->rupees = newRupeeCount;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-21
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity * CreateObject();
|
||||
extern Entity* CreateObject();
|
||||
extern void CopyPosition();
|
||||
extern void sub_08086A6C();
|
||||
extern s32 sub_080044EC();
|
||||
@@ -9,20 +9,18 @@ extern void sub_080AEF88();
|
||||
extern void DeleteThisEntity();
|
||||
extern u32 Random(void);
|
||||
|
||||
extern void (*gUnk_081206C4[99])(Entity *);
|
||||
extern void (*gUnk_081206C4[99])(Entity*);
|
||||
|
||||
extern u32 gUnk_080FD1A8;
|
||||
|
||||
//Main
|
||||
void sub_080869C4(Entity *ent)
|
||||
{
|
||||
// Main
|
||||
void sub_080869C4(Entity* ent) {
|
||||
gUnk_081206C4[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_080869DC(Entity *ent)
|
||||
{
|
||||
Entity *itemEntity;
|
||||
|
||||
void sub_080869DC(Entity* ent) {
|
||||
Entity* itemEntity;
|
||||
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 0;
|
||||
ent->boundingBox = &gUnk_080FD1A8;
|
||||
@@ -37,35 +35,31 @@ void sub_080869DC(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08086A28(Entity *ent)
|
||||
{
|
||||
void sub_08086A28(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
|
||||
if (ent->attachedEntity->field_0x4 == NULL) {
|
||||
ent->action = 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
iVar1 = sub_080044EC(ent, 10240);
|
||||
if (iVar1 == 0) {
|
||||
ent->action = 2;
|
||||
}
|
||||
sub_080AEF88(ent);
|
||||
CopyPosition(ent,ent->attachedEntity);
|
||||
CopyPosition(ent, ent->attachedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08086A5C(Entity *ent)
|
||||
{
|
||||
void sub_08086A5C(Entity* ent) {
|
||||
ent->attachedEntity->parent = NULL;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_08086A6C(Entity *ent)
|
||||
{
|
||||
void sub_08086A6C(Entity* ent) {
|
||||
u32 uVar1;
|
||||
|
||||
|
||||
uVar1 = Random();
|
||||
ent->field_0x20 = 163840;
|
||||
ent->direction = (uVar1 >> 16) & 31;
|
||||
ent->nonPlanarMovement = uVar1 & 480;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-13
@@ -4,38 +4,36 @@
|
||||
#include "link.h"
|
||||
|
||||
extern void _call_via_r2();
|
||||
extern void sub_08077E78(ItemBehavior *, u32);
|
||||
extern void sub_08077E78(ItemBehavior*, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_08078F60(void);
|
||||
extern void sub_08077D38(ItemBehavior *, u32);
|
||||
extern void sub_08077D38(ItemBehavior*, u32);
|
||||
extern void sub_0805E544(void);
|
||||
extern void UpdateItemAnim(ItemBehavior *);
|
||||
extern void UpdateItemAnim(ItemBehavior*);
|
||||
extern void CreateBird(void);
|
||||
extern void UnfreezeTime(void);
|
||||
|
||||
extern Entity gLinkEntity;
|
||||
extern LinkState gLinkState;
|
||||
extern void (*gOcarinaStates[4])(ItemBehavior *, u32);
|
||||
extern void (*gOcarinaStates[4])(ItemBehavior*, u32);
|
||||
extern u8 gUnk_02034490;
|
||||
|
||||
void Ocarina(ItemBehavior *pItemBeh,u32 inputFlags)
|
||||
void Ocarina(ItemBehavior* pItemBeh, u32 inputFlags)
|
||||
|
||||
{
|
||||
//u32 *ocarinaStates = &gOcarinaStates;
|
||||
// u32 *ocarinaStates = &gOcarinaStates;
|
||||
//_call_via_r2(pItemBeh, inputFlags,(ocarinaStates)[pItemBeh->stateID]);
|
||||
gOcarinaStates[pItemBeh->stateID](pItemBeh, inputFlags);
|
||||
gLinkEntity.itemCooldown = gLinkEntity.itemCooldown + 1;
|
||||
}
|
||||
|
||||
void OcarinaUse(ItemBehavior *itemBeh,s32 inputFlags)
|
||||
{
|
||||
void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) {
|
||||
u32 bVar1;
|
||||
u32 var;
|
||||
|
||||
if (gLinkState.linkAction == 24) {
|
||||
sub_08077E78(itemBeh,inputFlags);
|
||||
}
|
||||
else {
|
||||
sub_08077E78(itemBeh, inputFlags);
|
||||
} else {
|
||||
itemBeh->unk4 |= 15;
|
||||
gLinkEntity.animationState = 4;
|
||||
var = gLinkEntity.spriteSettings.raw & ~0x40;
|
||||
@@ -50,8 +48,8 @@ void OcarinaUse(ItemBehavior *itemBeh,s32 inputFlags)
|
||||
gLinkState.unk3 = bVar1 | gLinkState.unk3;
|
||||
gLinkState.keepFacing = bVar1 | gLinkState.keepFacing;
|
||||
sub_08078F60();
|
||||
sub_08077D38(itemBeh,inputFlags);
|
||||
sub_08077D38(itemBeh, inputFlags);
|
||||
PlaySFX(534);
|
||||
sub_0805E544();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
-48
@@ -18,117 +18,100 @@ extern u32 Random();
|
||||
extern void sub_0801ED14();
|
||||
extern void sub_08004274();
|
||||
|
||||
extern void (*gOctorok[2]);
|
||||
extern void (*gOctorokIdle[4])(Entity *);
|
||||
extern void (*gUnk_080CA158[4])(Entity *);
|
||||
extern void(*gOctorok[2]);
|
||||
extern void (*gOctorokIdle[4])(Entity*);
|
||||
extern void (*gUnk_080CA158[4])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CA170[8];
|
||||
//Main
|
||||
void sub_0801EAB0(Entity *ent)
|
||||
{
|
||||
// Main
|
||||
void sub_0801EAB0(Entity* ent) {
|
||||
EnemyFunctionHandler(ent, gOctorok);
|
||||
SetChildOffset(ent, 0, 1, -16);
|
||||
}
|
||||
|
||||
//Idle
|
||||
void sub_0801EAD0(Entity *ent)
|
||||
{
|
||||
// Idle
|
||||
void sub_0801EAD0(Entity* ent) {
|
||||
gOctorokIdle[ent->action](ent);
|
||||
}
|
||||
|
||||
//Touch player
|
||||
void sub_0801EAE8(Entity *ent)
|
||||
{
|
||||
// Touch player
|
||||
void sub_0801EAE8(Entity* ent) {
|
||||
if (ent->field_0x43 != 0) {
|
||||
sub_0804A9FC(ent, 28);
|
||||
}
|
||||
sub_0804AA30(ent, gOctorok);
|
||||
}
|
||||
|
||||
//Death
|
||||
void sub_0801EB0C(Entity *ent)
|
||||
{
|
||||
// Death
|
||||
void sub_0801EB0C(Entity* ent) {
|
||||
if ((ent->entityType).parameter1 == 0) {
|
||||
sub_0804A7D4(ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CreateDeathFx(ent, 241, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB2C(Entity *ent)
|
||||
{
|
||||
void sub_0801EB2C(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
|
||||
if ((ent->previousActionFlag < 3) && (iVar1 = sub_0806F520(ent), iVar1 == 0)) {
|
||||
sub_0801ECFC(ent);
|
||||
InitializeAnimation(ent, ent->animationState);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gUnk_080CA158[ent->previousActionFlag](ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB68(Entity *ent)
|
||||
{
|
||||
void sub_0801EB68(Entity* ent) {
|
||||
ent->previousActionFlag = 1;
|
||||
ent->filler[1] = 60;
|
||||
}
|
||||
|
||||
void sub_0801EB74(Entity *ent)
|
||||
{
|
||||
sub_0806F4E8(ent);
|
||||
void sub_0801EB74(Entity* ent) {
|
||||
sub_0806F4E8(ent);
|
||||
}
|
||||
|
||||
void sub_0801EB7C(Entity *ent)
|
||||
{
|
||||
void sub_0801EB7C(Entity* ent) {
|
||||
sub_0806F3E4(ent);
|
||||
}
|
||||
|
||||
void sub_0801EB84(Entity *ent)
|
||||
{
|
||||
void sub_0801EB84(Entity* ent) {
|
||||
ent->flags = ent->flags & 127;
|
||||
InitializeAnimationAnimation(ent, 2);
|
||||
}
|
||||
|
||||
void nullsub_3()
|
||||
{
|
||||
void nullsub_3() {
|
||||
}
|
||||
|
||||
void sub_0801EB9C(Entity *ent)
|
||||
{
|
||||
void sub_0801EB9C(Entity* ent) {
|
||||
if ((ent->flags & 128) != 0) {
|
||||
ent->flags = ent->flags | 128;
|
||||
ent->field_0x3a = ent->field_0x3a & 251;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ent->currentHealth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Init
|
||||
// Init
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0801EBC8(Entity *ent)
|
||||
{
|
||||
void sub_0801EBC8(Entity* ent) {
|
||||
sub_0804A720();
|
||||
ent->animationState = (ent->entityType).parameter1 == 2 ? (ent->entityType).parameter1 : Random() & 3;
|
||||
ent->filler[0] = 18;
|
||||
sub_0801ECFC(ent);
|
||||
InitializeAnimation(ent,ent->animationState);
|
||||
InitializeAnimation(ent, ent->animationState);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0801EBC8(Entity *ent)
|
||||
{
|
||||
asm(".include \"asm/octorok/sub_0801EBC8.inc\"");
|
||||
void sub_0801EBC8(Entity* ent) {
|
||||
asm(".include \"asm/octorok/sub_0801EBC8.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0801EBF4(Entity *ent)
|
||||
{
|
||||
void sub_0801EBF4(Entity* ent) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
|
||||
bVar1 = ent->parameter3 -= 1;
|
||||
if (bVar1 == 0) {
|
||||
ent->action = 2;
|
||||
@@ -137,4 +120,4 @@ void sub_0801EBF4(Entity *ent)
|
||||
sub_0801ED14(ent);
|
||||
}
|
||||
sub_08004274(ent);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,19 +1,19 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void UpdateSpriteOrderAndFlip(Entity *);
|
||||
extern void UpdateSpriteOrderAndFlip(Entity*);
|
||||
|
||||
void PositionRelative(Entity *source, Entity *target, s32 offsetX, s32 offsetY) { //r0, r1, r2, r3
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
x = source->x.WORD;
|
||||
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) { // r0, r1, r2, r3
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
x = source->x.WORD;
|
||||
target->x.WORD = x + offsetX;
|
||||
|
||||
y = source->y.WORD;
|
||||
|
||||
y = source->y.WORD;
|
||||
target->y.WORD = y + offsetY;
|
||||
|
||||
target->height = source->height; //ldr
|
||||
target->collisionLayer = source->collisionLayer;
|
||||
UpdateSpriteOrderAndFlip(target);
|
||||
}
|
||||
|
||||
target->height = source->height; // ldr
|
||||
target->collisionLayer = source->collisionLayer;
|
||||
UpdateSpriteOrderAndFlip(target);
|
||||
}
|
||||
|
||||
+7
-8
@@ -8,10 +8,10 @@ extern u32 gUnk_0200B650;
|
||||
extern u32 gUnk_02025EB0;
|
||||
extern u8 gUnk_030010A0[10];
|
||||
|
||||
extern void sub_08080840(Entity *);
|
||||
extern void sub_08080840(Entity*);
|
||||
extern void sub_080809D4();
|
||||
|
||||
void sub_0808091C(Entity *param_1,u32 param_2)
|
||||
void sub_0808091C(Entity* param_1, u32 param_2)
|
||||
|
||||
{
|
||||
sub_08080840(param_1);
|
||||
@@ -30,22 +30,21 @@ void sub_08080930(void)
|
||||
return;
|
||||
}
|
||||
|
||||
u32 * GetLayerByIndex(u32 param_1)
|
||||
u32* GetLayerByIndex(u32 param_1)
|
||||
|
||||
{
|
||||
|
||||
|
||||
if (param_1 == 2) {
|
||||
return &gUnk_0200B650;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return &gUnk_02025EB0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080964(u16 time,u32 magnitude)
|
||||
void sub_08080964(u16 time, u32 magnitude)
|
||||
|
||||
{
|
||||
gRoomControls.screenShakeTime = time;
|
||||
gRoomControls.screenShakeMagnitude = magnitude & 7;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+48
-56
@@ -2,64 +2,59 @@
|
||||
#include "entity.h"
|
||||
|
||||
typedef struct {
|
||||
void * field_0x0;
|
||||
void * entityCount;
|
||||
void* field_0x0;
|
||||
void* entityCount;
|
||||
u8 freezeTime;
|
||||
} EntityHandler;
|
||||
|
||||
extern void EnemyFunctionHandler(Entity *, void *);
|
||||
extern void SetChildOffset(Entity *, u32, u32, u32);
|
||||
extern void sub_0804AA30(Entity *, void *);
|
||||
extern void sub_0804A9FC(Entity *, u32);
|
||||
extern void sub_0804A720(Entity *);
|
||||
extern void InitializeAnimation(Entity *, u32);
|
||||
extern void sub_08044FF8(Entity *);
|
||||
extern void EnemyFunctionHandler(Entity*, void*);
|
||||
extern void SetChildOffset(Entity*, u32, u32, u32);
|
||||
extern void sub_0804AA30(Entity*, void*);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void InitializeAnimation(Entity*, u32);
|
||||
extern void sub_08044FF8(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void sub_08004274(Entity *);
|
||||
extern void sub_08004274(Entity*);
|
||||
extern u32 sub_0806FA04(u32, u32);
|
||||
extern u32 sub_08049FA0(Entity *);
|
||||
extern u32 sub_08049EE4(Entity *);
|
||||
extern u32 sub_08049FA0(Entity*);
|
||||
extern u32 sub_08049EE4(Entity*);
|
||||
extern u32 sub_080AEF88(void);
|
||||
extern Entity * CreateEnemy(u32, u32);
|
||||
extern Entity* CreateEnemy(u32, u32);
|
||||
|
||||
|
||||
extern void (*gUnk_080D16BC[])(Entity *);
|
||||
extern void (*gUnk_080D16A4[])(Entity *);
|
||||
extern void (*gUnk_080D16BC[])(Entity*);
|
||||
extern void (*gUnk_080D16A4[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080D16D0;
|
||||
extern EntityHandler gUnk_03003DB8;
|
||||
|
||||
|
||||
void sub_08044F50(Entity *this)
|
||||
void sub_08044F50(Entity* this)
|
||||
|
||||
{
|
||||
EnemyFunctionHandler(this, &gUnk_080D16A4);
|
||||
SetChildOffset(this,0,1,-12);
|
||||
SetChildOffset(this, 0, 1, -12);
|
||||
}
|
||||
|
||||
void sub_08044F70(Entity *this)
|
||||
{
|
||||
void sub_08044F70(Entity* this) {
|
||||
gUnk_080D16BC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08044F88(Entity *this)
|
||||
{
|
||||
void sub_08044F88(Entity* this) {
|
||||
if ((this->currentHealth != 0) && (this->cutsceneBeh.HALF.LO != this->currentHealth)) {
|
||||
this->action = 4;
|
||||
}
|
||||
else {
|
||||
sub_0804AA30(this,&gUnk_080D16A4);
|
||||
} else {
|
||||
sub_0804AA30(this, &gUnk_080D16A4);
|
||||
}
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this,28);
|
||||
sub_0804A9FC(this, 28);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_171(){}
|
||||
void nullsub_171() {
|
||||
}
|
||||
|
||||
void sub_08044FC8(Entity *this)
|
||||
{
|
||||
void sub_08044FC8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->nonPlanarMovement = 128;
|
||||
@@ -68,23 +63,21 @@ void sub_08044FC8(Entity *this)
|
||||
sub_08044FF8(this);
|
||||
}
|
||||
|
||||
void sub_08044FF8(Entity *this)
|
||||
{
|
||||
void sub_08044FF8(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
|
||||
this->action = 2;
|
||||
bVar1 = Random();
|
||||
this->parameter3 = (bVar1 & 31) + 30;
|
||||
this->cutsceneBeh.HALF.LO = this->currentHealth;
|
||||
}
|
||||
|
||||
void sub_08045018(Entity *this)
|
||||
{
|
||||
void sub_08045018(Entity* this) {
|
||||
u32 cVar1;
|
||||
u32 param3;
|
||||
u32 iVar3;
|
||||
u32 randValue;
|
||||
|
||||
|
||||
sub_08004274(this);
|
||||
param3 = this->parameter3 -= 1;
|
||||
if (param3 == 0) {
|
||||
@@ -96,17 +89,16 @@ void sub_08045018(Entity *this)
|
||||
iVar3 = sub_08049FA0(this);
|
||||
if ((iVar3 == 0) && (randValue = Random(), (randValue & 3) != 0)) {
|
||||
cVar1 = sub_08049EE4(this);
|
||||
this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24;
|
||||
this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24;
|
||||
return;
|
||||
}
|
||||
this->direction = Random() & 24;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08045088(Entity *this)
|
||||
{
|
||||
void sub_08045088(Entity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
|
||||
sub_080AEF88();
|
||||
sub_08004274(this);
|
||||
bVar1 = this->parameter3 -= 1;
|
||||
@@ -116,22 +108,22 @@ void sub_08045088(Entity *this)
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_080450A8(Entity *this)
|
||||
void sub_080450A8(Entity* this)
|
||||
|
||||
{
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
s32 iVar3;
|
||||
s32 iVar4;
|
||||
Entity *pEVar5;
|
||||
Entity **ppEVar6;
|
||||
Entity* pEVar5;
|
||||
Entity** ppEVar6;
|
||||
s32 dividend;
|
||||
u32 uVar7;
|
||||
Entity *local_r6_72;
|
||||
Entity* local_r6_72;
|
||||
u32 divisor;
|
||||
u8 *pcVar8;
|
||||
Entity *local_2c [4];
|
||||
|
||||
u8* pcVar8;
|
||||
Entity* local_2c[4];
|
||||
|
||||
ppEVar6 = local_2c;
|
||||
bVar1 = (&gUnk_080D16D0)[(this->entityType).parameter1];
|
||||
divisor = (u32)bVar1;
|
||||
@@ -139,7 +131,7 @@ void sub_080450A8(Entity *this)
|
||||
uVar7 = divisor;
|
||||
if (bVar1 != 0) {
|
||||
do {
|
||||
uVar2 = CreateEnemy(87,this->entityType.parameter1);
|
||||
uVar2 = CreateEnemy(87, this->entityType.parameter1);
|
||||
*ppEVar6 = uVar2;
|
||||
ppEVar6 = ppEVar6 + 1;
|
||||
uVar7 = uVar7 - 1;
|
||||
@@ -151,28 +143,28 @@ void sub_080450A8(Entity *this)
|
||||
do {
|
||||
local_r6_72 = local_2c[iVar4];
|
||||
dividend = iVar4 + 1;
|
||||
iVar3 = Div(dividend,divisor);
|
||||
iVar3 = Div(dividend, divisor);
|
||||
local_r6_72->attachedEntity = local_2c[iVar3];
|
||||
iVar4 = Div(iVar4 + divisor + -1,divisor);
|
||||
iVar4 = Div(iVar4 + divisor + -1, divisor);
|
||||
local_r6_72->parent = local_2c[iVar4];
|
||||
(local_r6_72->entityType).parameter2 = 1;
|
||||
local_r6_72->height.WORD = 0;
|
||||
local_r6_72->hurtBlinkTime = 240;
|
||||
sub_08045178(this,local_r6_72,*pcVar8,pcVar8[1]);
|
||||
sub_08045178(this, local_r6_72, *pcVar8, pcVar8[1]);
|
||||
pcVar8 = pcVar8 + 2;
|
||||
iVar4 = dividend;
|
||||
} while (dividend < divisor);
|
||||
}
|
||||
pEVar5 = CreateFx(this,2,0);
|
||||
pEVar5 = CreateFx(this, 2, 0);
|
||||
if (pEVar5 != NULL) {
|
||||
CopyPosition(this,pEVar5);
|
||||
CopyPosition(this, pEVar5);
|
||||
}
|
||||
DeleteEnemy(this);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_080450A8(Entity *this) {
|
||||
asm(".include \"asm/non_matching/slime/sub_080450A8.inc\"");
|
||||
void sub_080450A8(Entity* this) {
|
||||
asm(".include \"asm/non_matching/slime/sub_080450A8.inc\"");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+22
-34
@@ -2,11 +2,11 @@
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
extern void InitializeAnimation(Entity *, u32);
|
||||
extern void sub_08078778(Entity *);
|
||||
extern void sub_0805E47C(Entity *);
|
||||
extern void sub_08004274(Entity *);
|
||||
extern void sub_0806ED78(Entity *);
|
||||
extern void InitializeAnimation(Entity*, u32);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern void sub_0805E47C(Entity*);
|
||||
extern void sub_08004274(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void TextboxTryNoOverlap(u32);
|
||||
extern void sub_0805E584();
|
||||
extern void sub_0807DD64();
|
||||
@@ -17,18 +17,17 @@ extern void sub_0807DDE4();
|
||||
extern u32 sub_0801E7F4();
|
||||
extern void ShowNPCDialogue();
|
||||
|
||||
|
||||
extern void (*gStampBehaviors1[4])(Entity*);
|
||||
extern void (*gStampBehaviors2[2])(Entity*);
|
||||
|
||||
extern TextBox gTextBox;
|
||||
extern u32 gUnk_0810C2E4;
|
||||
|
||||
extern void InitializeAnimation(Entity *, u32);
|
||||
extern void sub_08078778(Entity *);
|
||||
extern void sub_0805E47C(Entity *);
|
||||
extern void sub_08004274(Entity *);
|
||||
extern void sub_0806ED78(Entity *);
|
||||
extern void InitializeAnimation(Entity*, u32);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern void sub_0805E47C(Entity*);
|
||||
extern void sub_08004274(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void TextboxTryNoOverlap(u32);
|
||||
extern void sub_0805E584();
|
||||
extern void sub_0807DD64();
|
||||
@@ -39,33 +38,28 @@ extern void sub_0807DDE4();
|
||||
extern u32 sub_0801E7F4();
|
||||
extern void ShowNPCDialogue();
|
||||
|
||||
|
||||
extern void (*gStampBehaviors1[4])(Entity*);
|
||||
extern void (*gStampBehaviors2[2])(Entity*);
|
||||
|
||||
extern TextBox gTextBox;
|
||||
extern u32 gUnk_0810C2E4;
|
||||
|
||||
void sub_08062B98(Entity *ent)
|
||||
{
|
||||
void sub_08062B98(Entity* ent) {
|
||||
if ((ent->flags & 2) != 0) {
|
||||
gStampBehaviors2[ent->action](ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gStampBehaviors1[ent->action](ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062BD4(Entity *ent)
|
||||
{
|
||||
void sub_08062BD4(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
InitializeAnimation(ent, 0);
|
||||
sub_08078778(ent);
|
||||
}
|
||||
|
||||
void sub_08062BF8(Entity *ent)
|
||||
{
|
||||
void sub_08062BF8(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
if (ent->interactType != 0) {
|
||||
ent->interactType = 0;
|
||||
@@ -75,8 +69,7 @@ void sub_08062BF8(Entity *ent)
|
||||
sub_0806ED78(ent);
|
||||
}
|
||||
|
||||
void sub_08062C24(Entity *ent)
|
||||
{
|
||||
void sub_08062C24(Entity* ent) {
|
||||
sub_08004274(ent);
|
||||
if ((ent->frames.all & 128) != 0) {
|
||||
InitializeAnimation(ent, 4);
|
||||
@@ -85,8 +78,7 @@ void sub_08062C24(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062C54(Entity *ent)
|
||||
{
|
||||
void sub_08062C54(Entity* ent) {
|
||||
if ((gTextBox.doTextBox & 127) == 0) {
|
||||
ent->action = 1;
|
||||
InitializeAnimation(ent, 0);
|
||||
@@ -94,8 +86,7 @@ void sub_08062C54(Entity *ent)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062C7C(Entity *ent)
|
||||
{
|
||||
void sub_08062C7C(Entity* ent) {
|
||||
ent->action = 1;
|
||||
sub_0807DD64(ent);
|
||||
InitializeAnimation(ent, 0);
|
||||
@@ -103,24 +94,21 @@ void sub_08062C7C(Entity *ent)
|
||||
sub_08062CA4(ent);
|
||||
}
|
||||
|
||||
void sub_08062CA4(Entity *ent)
|
||||
{
|
||||
void sub_08062CA4(Entity* ent) {
|
||||
sub_0807DDAC(ent, 0);
|
||||
sub_0807DDE4(ent);
|
||||
sub_08004274(ent);
|
||||
}
|
||||
|
||||
void sub_08062CBC(Entity *ent)
|
||||
{
|
||||
void sub_08062CBC(Entity* ent) {
|
||||
u32 uVar1;
|
||||
|
||||
|
||||
uVar1 = sub_0801E7F4(44);
|
||||
ShowNPCDialogue(ent, &gUnk_0810C2E4 + ((-uVar1 | uVar1) >> 31) * 2);
|
||||
}
|
||||
|
||||
void sub_08062CE0(Entity *ent)
|
||||
{
|
||||
void sub_08062CE0(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
#include "global.h"
|
||||
void sub_0801D5EC(u32 a1, u32 a2, u32 a3)
|
||||
{
|
||||
void sub_0801D5EC(u32 a1, u32 a2, u32 a3) {
|
||||
DmaFill16(3, a1, a2, a3);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-10
@@ -3,14 +3,13 @@
|
||||
extern void sub_0807C960();
|
||||
extern u32 sub_0801D754(u32, u8, u8);
|
||||
|
||||
u32 sub_0807C9D8(u32 *a1)
|
||||
{
|
||||
u32 *v1; // r5@1
|
||||
u32 sub_0807C9D8(u32* a1) {
|
||||
u32* v1; // r5@1
|
||||
|
||||
v1 = a1;
|
||||
sub_0807C960(0x6004000, *a1);
|
||||
sub_0807C960(0x6000000, v1[1]);
|
||||
sub_0807C960(0x6008000, v1[2]);
|
||||
sub_0807C960(0x20176E0, v1[3]);
|
||||
return sub_0801D754(0x20176E0, 2, 13);
|
||||
}
|
||||
v1 = a1;
|
||||
sub_0807C960(0x6004000, *a1);
|
||||
sub_0807C960(0x6000000, v1[1]);
|
||||
sub_0807C960(0x6008000, v1[2]);
|
||||
sub_0807C960(0x20176E0, v1[3]);
|
||||
return sub_0801D754(0x20176E0, 2, 13);
|
||||
}
|
||||
|
||||
+15
-17
@@ -10,30 +10,28 @@ extern u8 gUnk_03001000;
|
||||
u32 sub_0804AA84(void)
|
||||
|
||||
{
|
||||
u8 * r3 = &gArea;
|
||||
u8 * r2;
|
||||
u8 r0 = *(u8 *)(r3 + 0x19);
|
||||
u8 r1;
|
||||
|
||||
u8 * r3 = &gArea;
|
||||
u8 * r2;
|
||||
u8 r0 = *(u8 *)(r3 + 0x19);
|
||||
u8 r1;
|
||||
|
||||
if (!r0) {
|
||||
*(r3 + 0x18) = r0;
|
||||
*(r3 + 0x19) = r0;
|
||||
r0 = 0;
|
||||
}
|
||||
*(r3 + 0x18) = r0;
|
||||
*(r3 + 0x19) = r0;
|
||||
r0 = 0;
|
||||
}
|
||||
else {
|
||||
r2 = &gUnk_03001000;
|
||||
r1 = 0;
|
||||
r0 = 4;
|
||||
r2 = &gUnk_03001000;
|
||||
r1 = 0;
|
||||
r0 = 4;
|
||||
*(r2 + 0x4) = r0;
|
||||
*(r3 + 0xe) = r1;
|
||||
*(r3 + 0xf) = r1;
|
||||
*(u16*)(r3 + 0x10) = r1;
|
||||
sub_0805E5A8();
|
||||
r0 = 1;
|
||||
r0 = 1;
|
||||
}
|
||||
return r0;
|
||||
return r0;
|
||||
} */
|
||||
|
||||
//void sub_0804AA9C() {
|
||||
|
||||
|
||||
// void sub_0804AA9C() {
|
||||
|
||||
+21
-23
@@ -1,15 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
|
||||
extern void sub_080186EC();
|
||||
extern u32 * sub_0804B128(u8);
|
||||
extern u32 _call_via_r0(u32 *);
|
||||
extern u32* sub_0804B128(u8);
|
||||
extern u32 _call_via_r0(u32*);
|
||||
extern void sub_0804B16C();
|
||||
|
||||
void sub_0804AFF4(void)
|
||||
{
|
||||
u32 *func;
|
||||
|
||||
void sub_0804AFF4(void) {
|
||||
u32* func;
|
||||
|
||||
sub_080186EC();
|
||||
func = sub_0804B128(5);
|
||||
if (func != NULL) {
|
||||
@@ -24,22 +22,22 @@ void sub_0804AFF4(void)
|
||||
}
|
||||
|
||||
/*
|
||||
thumb_func_start sub_0804AFF4
|
||||
thumb_func_start sub_0804AFF4
|
||||
sub_0804AFF4: @ 0x0804AFF4
|
||||
push {lr}
|
||||
bl sub_080186EC
|
||||
movs r0, #5
|
||||
bl sub_0804B128
|
||||
cmp r0, #0
|
||||
beq _0804B008
|
||||
bl _call_via_r0
|
||||
push {lr}
|
||||
bl sub_080186EC
|
||||
movs r0, #5
|
||||
bl sub_0804B128
|
||||
cmp r0, #0
|
||||
beq _0804B008
|
||||
bl _call_via_r0
|
||||
_0804B008:
|
||||
movs r0, #7
|
||||
bl sub_0804B128
|
||||
cmp r0, #0
|
||||
beq _0804B016
|
||||
bl _call_via_r0
|
||||
movs r0, #7
|
||||
bl sub_0804B128
|
||||
cmp r0, #0
|
||||
beq _0804B016
|
||||
bl _call_via_r0
|
||||
_0804B016:
|
||||
bl sub_0804B16C
|
||||
pop {pc}
|
||||
*/
|
||||
bl sub_0804B16C
|
||||
pop {pc}
|
||||
*/
|
||||
|
||||
+8
-9
@@ -4,14 +4,13 @@ extern u32 gUnk_020354C0;
|
||||
extern s32 gUnk_03000FD0;
|
||||
extern void sub_0801D630(u32, u32, u32);
|
||||
|
||||
void sub_08050008(u32 param_1,u32 param_2,u32 param_3)
|
||||
{
|
||||
s32 * unk;
|
||||
|
||||
sub_0801D630((u32)&gUnk_020354C0,128,param_3);
|
||||
|
||||
unk = &gUnk_03000FD0;
|
||||
void sub_08050008(u32 param_1, u32 param_2, u32 param_3) {
|
||||
s32* unk;
|
||||
|
||||
sub_0801D630((u32)&gUnk_020354C0, 128, param_3);
|
||||
|
||||
unk = &gUnk_03000FD0;
|
||||
*(unk + 1) = -1;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-15
@@ -3,22 +3,20 @@
|
||||
extern void sub_0801E104();
|
||||
extern void DoFade(u32, u32);
|
||||
|
||||
void sub_08050024()
|
||||
{
|
||||
sub_0801E104();
|
||||
DoFade(5, 0x80 << 1);
|
||||
return;
|
||||
void sub_08050024() {
|
||||
sub_0801E104();
|
||||
DoFade(5, 0x80 << 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* thumb_func_start sub_08050024
|
||||
sub_08050024: @ 0x08050024
|
||||
push {lr}
|
||||
bl sub_0801E104
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #1
|
||||
movs r0, #5
|
||||
bl DoFade
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
*/
|
||||
push {lr}
|
||||
bl sub_0801E104
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #1
|
||||
movs r0, #5
|
||||
bl DoFade
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
*/
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
|
||||
extern u8 gArea;
|
||||
|
||||
bool32 sub_08052620(u32 r0)
|
||||
{
|
||||
bool32 sub_08052620(u32 r0) {
|
||||
return gArea == 0x81;
|
||||
}
|
||||
|
||||
+4
-5
@@ -2,10 +2,9 @@
|
||||
|
||||
extern u8 gUnk_08127D30[69];
|
||||
|
||||
u32 sub_08052638(u32 r0)
|
||||
{
|
||||
//u32 r1 = gUnk_08127D30;
|
||||
//u32 r1 = gUnk_08127D30;
|
||||
u32 sub_08052638(u32 r0) {
|
||||
// u32 r1 = gUnk_08127D30;
|
||||
// u32 r1 = gUnk_08127D30;
|
||||
|
||||
return gUnk_08127D30[r0 * 4] == 129;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
extern u32 * _call_via_r0(u32 *func);
|
||||
extern u32* _call_via_r0(u32* func);
|
||||
extern u8 gUnk_02000080;
|
||||
extern u32 *gUnk_080FF420;
|
||||
extern u32* gUnk_080FF420;
|
||||
|
||||
void sub_08055E08() {
|
||||
u32 **arr = &gUnk_080FF420;
|
||||
u32** arr = &gUnk_080FF420;
|
||||
u8 i = gUnk_02000080;
|
||||
i = *(&gUnk_02000080 + 6);
|
||||
_call_via_r0(arr[i]);
|
||||
}
|
||||
i = *(&gUnk_02000080 + 6);
|
||||
_call_via_r0(arr[i]);
|
||||
}
|
||||
|
||||
+6
-7
@@ -1,15 +1,14 @@
|
||||
#include "entity.h"
|
||||
extern Entity * sub_0805E3A0(Entity *, u32);
|
||||
extern Entity* sub_0805E3A0(Entity*, u32);
|
||||
extern u8 gUnk_030010A0[];
|
||||
extern u8 gUnk_081091F8[];
|
||||
extern u8 gUnk_081091EE[];
|
||||
Entity * sub_0805E374(Entity *param_1)
|
||||
{
|
||||
Entity* sub_0805E374(Entity* param_1) {
|
||||
u8 r3 = gUnk_030010A0[0x2C];
|
||||
u8 *array = gUnk_081091F8;
|
||||
u8* array = gUnk_081091F8;
|
||||
|
||||
if ( r3 != '\x02') {
|
||||
if (r3 != '\x02') {
|
||||
array = gUnk_081091EE;
|
||||
}
|
||||
return sub_0805E3A0(param_1,array[(param_1->entityType).type]);
|
||||
}
|
||||
return sub_0805E3A0(param_1, array[(param_1->entityType).type]);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
Entity * sub_0805E3A0(Entity *ent, u32 param){
|
||||
//these are bitfields
|
||||
ent->scriptedScene2 = param;
|
||||
Entity* sub_0805E3A0(Entity* ent, u32 param) {
|
||||
// these are bitfields
|
||||
ent->scriptedScene2 = param;
|
||||
ent->scriptedScene = param;
|
||||
return ent;
|
||||
return ent;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
s32 sub_0806F9EC(s16 param_1,s16 param_2)
|
||||
s32 sub_0806F9EC(s16 param_1, s16 param_2)
|
||||
|
||||
{
|
||||
int iVar1;
|
||||
|
||||
|
||||
iVar1 = (s32)param_1 * (s32)param_2;
|
||||
if (iVar1 < 0) {
|
||||
iVar1 = iVar1 + 255;
|
||||
}
|
||||
return (iVar1 << 8) >> 16;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -2,18 +2,17 @@
|
||||
|
||||
extern s32 __divsi3(s32, s32);
|
||||
|
||||
s16 sub_0806FA04(s16 param_1,s16 param_2)
|
||||
s16 sub_0806FA04(s16 param_1, s16 param_2)
|
||||
|
||||
{
|
||||
s16 sVar1;
|
||||
s32 iVar2;
|
||||
|
||||
|
||||
if (param_2 != 0) {
|
||||
sVar1 = __divsi3( (param_1 << 16) >> 8 ,param_2);
|
||||
sVar1 = __divsi3((param_1 << 16) >> 8, param_2);
|
||||
iVar2 = sVar1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
iVar2 = 0;
|
||||
}
|
||||
return iVar2;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
void PositionRelative(Entity *, Entity *, s32, s32);
|
||||
void PositionRelative(Entity*, Entity*, s32, s32);
|
||||
|
||||
void CopyPosition(Entity *param_1,Entity *param_2)
|
||||
void CopyPosition(Entity* param_1, Entity* param_2)
|
||||
|
||||
{
|
||||
PositionRelative(param_1, param_2, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+17
-17
@@ -1,23 +1,23 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
extern void PositionRelative(Entity *, Entity *, s32, s32);
|
||||
extern void sub_0806FAB0(Entity *, Entity *);
|
||||
extern void PositionRelative(Entity*, Entity*, s32, s32);
|
||||
extern void sub_0806FAB0(Entity*, Entity*);
|
||||
|
||||
void sub_0806FA30(Entity * ent, Entity * ent2) {
|
||||
PositionRelative(ent, ent2, 0, 0);
|
||||
sub_0806FAB0(ent, ent2);
|
||||
void sub_0806FA30(Entity* ent, Entity* ent2) {
|
||||
PositionRelative(ent, ent2, 0, 0);
|
||||
sub_0806FAB0(ent, ent2);
|
||||
}
|
||||
/*
|
||||
thumb_func_start sub_0806FA30
|
||||
thumb_func_start sub_0806FA30
|
||||
sub_0806FA30: @ 0x0806FA30
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
adds r5, r1, #0
|
||||
movs r2, #0
|
||||
movs r3, #0
|
||||
bl PositionRelative
|
||||
adds r0, r4, #0
|
||||
adds r1, r5, #0
|
||||
bl sub_0806FAB0
|
||||
pop {r4, r5, pc}
|
||||
*/
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
adds r5, r1, #0
|
||||
movs r2, #0
|
||||
movs r3, #0
|
||||
bl PositionRelative
|
||||
adds r0, r4, #0
|
||||
adds r1, r5, #0
|
||||
bl sub_0806FAB0
|
||||
pop {r4, r5, pc}
|
||||
*/
|
||||
|
||||
+5
-6
@@ -1,10 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void (*gUnk_0811B9E0[])(Entity *);
|
||||
extern void (*gUnk_0811B9E0[])(Entity*);
|
||||
|
||||
|
||||
//inject
|
||||
void sub_08070680(Entity *this) {
|
||||
gUnk_0811B9E0[this->action](this);
|
||||
}
|
||||
// inject
|
||||
void sub_08070680(Entity* this) {
|
||||
gUnk_0811B9E0[this->action](this);
|
||||
}
|
||||
|
||||
+9
-10
@@ -4,19 +4,18 @@ extern void sub_08000152(u32);
|
||||
extern void sub_0807B778(u32, u32);
|
||||
extern void SetTileType(u32, u32, u32);
|
||||
|
||||
void sub_0807B7D8(u32 param_1,u32 param_2,u32 param_3)
|
||||
void sub_0807B7D8(u32 param_1, u32 param_2, u32 param_3)
|
||||
|
||||
{
|
||||
if (param_1 == 53) {
|
||||
sub_08000152(53);
|
||||
sub_0807B778(param_2,param_3);
|
||||
sub_0807B778(param_2 + 1,param_3);
|
||||
sub_0807B778(param_2 + -1,param_3);
|
||||
sub_0807B778(param_2 + 64,param_3);
|
||||
sub_0807B778(param_2 + -64,param_3);
|
||||
}
|
||||
else {
|
||||
SetTileType(param_1,param_2,param_3);
|
||||
sub_0807B778(param_2, param_3);
|
||||
sub_0807B778(param_2 + 1, param_3);
|
||||
sub_0807B778(param_2 + -1, param_3);
|
||||
sub_0807B778(param_2 + 64, param_3);
|
||||
sub_0807B778(param_2 + -64, param_3);
|
||||
} else {
|
||||
SetTileType(param_1, param_2, param_3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -5,14 +5,14 @@ extern void SetTileType(u32, u32, u32);
|
||||
void sub_0807B820(u32 param_1)
|
||||
|
||||
{
|
||||
SetTileType(620,param_1 + -65,1);
|
||||
SetTileType(627,param_1 + -65,2);
|
||||
SetTileType(621,param_1 + -64,1);
|
||||
SetTileType(628,param_1 + -64,2);
|
||||
SetTileType(622,param_1 + -63,1);
|
||||
SetTileType(629,param_1 + -63,2);
|
||||
SetTileType(623,param_1 + -1,1);
|
||||
SetTileType(624,param_1,1);
|
||||
SetTileType(626,param_1 + 1,1);
|
||||
SetTileType(620, param_1 + -65, 1);
|
||||
SetTileType(627, param_1 + -65, 2);
|
||||
SetTileType(621, param_1 + -64, 1);
|
||||
SetTileType(628, param_1 + -64, 2);
|
||||
SetTileType(622, param_1 + -63, 1);
|
||||
SetTileType(629, param_1 + -63, 2);
|
||||
SetTileType(623, param_1 + -1, 1);
|
||||
SetTileType(624, param_1, 1);
|
||||
SetTileType(626, param_1 + 1, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -5,14 +5,14 @@ extern void SetTileType(u32, u32, u32);
|
||||
void sub_0807B8A8(u32 param_1)
|
||||
|
||||
{
|
||||
SetTileType(636,param_1 + -65,1);
|
||||
SetTileType(643,param_1 + -65,2);
|
||||
SetTileType(637,param_1 + -64,1);
|
||||
SetTileType(644,param_1 + -64,2);
|
||||
SetTileType(638,param_1 + -63,1);
|
||||
SetTileType(645,param_1 + -63,2);
|
||||
SetTileType(639,param_1 + -1,1);
|
||||
SetTileType(640,param_1,1);
|
||||
SetTileType(642,param_1 + 1,1);
|
||||
SetTileType(636, param_1 + -65, 1);
|
||||
SetTileType(643, param_1 + -65, 2);
|
||||
SetTileType(637, param_1 + -64, 1);
|
||||
SetTileType(644, param_1 + -64, 2);
|
||||
SetTileType(638, param_1 + -63, 1);
|
||||
SetTileType(645, param_1 + -63, 2);
|
||||
SetTileType(639, param_1 + -1, 1);
|
||||
SetTileType(640, param_1, 1);
|
||||
SetTileType(642, param_1 + 1, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-10
@@ -1,19 +1,18 @@
|
||||
#include "global.h"
|
||||
|
||||
|
||||
extern void SetTileType(u32, u32, u32);
|
||||
|
||||
void sub_0807B930(int param_1)
|
||||
|
||||
{
|
||||
SetTileType(652,param_1 + -65,1);
|
||||
SetTileType(659,param_1 + -65,2);
|
||||
SetTileType(653,param_1 + -64,1);
|
||||
SetTileType(660,param_1 + -64,2);
|
||||
SetTileType(654,param_1 + -63,1);
|
||||
SetTileType(661,param_1 + -63,2);
|
||||
SetTileType(655,param_1 + -1,1);
|
||||
SetTileType(656,param_1,1);
|
||||
SetTileType(658,param_1 + 1,1);
|
||||
SetTileType(652, param_1 + -65, 1);
|
||||
SetTileType(659, param_1 + -65, 2);
|
||||
SetTileType(653, param_1 + -64, 1);
|
||||
SetTileType(660, param_1 + -64, 2);
|
||||
SetTileType(654, param_1 + -63, 1);
|
||||
SetTileType(661, param_1 + -63, 2);
|
||||
SetTileType(655, param_1 + -1, 1);
|
||||
SetTileType(656, param_1, 1);
|
||||
SetTileType(658, param_1 + 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-2
@@ -4,8 +4,7 @@ extern void sub_0807C960();
|
||||
extern u32 gUnk_0202CEB4;
|
||||
extern u32 gUnk_02012654;
|
||||
|
||||
void sub_0807C998(u32 *a1)
|
||||
{
|
||||
void sub_0807C998(u32* a1) {
|
||||
sub_0807C960(&gUnk_0202CEB4, a1[0]);
|
||||
sub_0807C960(&gUnk_0202CEB4 - 0x800, a1[1]);
|
||||
sub_0807C960(&gUnk_02012654, a1[2]);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ u32 sub_080A554C(u32 param_1)
|
||||
|
||||
{
|
||||
u32 uVar1;
|
||||
|
||||
|
||||
if (param_1 != 0) {
|
||||
uVar1 = 0;
|
||||
do {
|
||||
|
||||
+3
-5
@@ -3,15 +3,13 @@
|
||||
extern s32 sub_080ADA14(u32, u32);
|
||||
extern u16 gUnk_03001010[4];
|
||||
|
||||
|
||||
void sub_080AD644(void)
|
||||
{
|
||||
void sub_080AD644(void) {
|
||||
|
||||
gUnk_03001010[2] = 0;
|
||||
gUnk_03001010[3] = 0;
|
||||
gUnk_03001010[4] = 57376;
|
||||
gUnk_03001010[0] = 120;
|
||||
gUnk_03001010[1] = 152;
|
||||
sub_080ADA14(511,1);
|
||||
sub_080ADA14(511, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -2,10 +2,9 @@
|
||||
|
||||
extern u8 gUnk_08127D30[69];
|
||||
|
||||
u32 sub_08052654(u32 r0)
|
||||
{
|
||||
//u32 r1 = gUnk_08127D30;
|
||||
//u32 r1 = gUnk_08127D30;
|
||||
u32 sub_08052654(u32 r0) {
|
||||
// u32 r1 = gUnk_08127D30;
|
||||
// u32 r1 = gUnk_08127D30;
|
||||
|
||||
return gUnk_08127D30[r0 * 4] == 129;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-19
@@ -3,7 +3,7 @@
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
void TextboxNoOverlap(u32 index,Entity *ent);
|
||||
void TextboxNoOverlap(u32 index, Entity* ent);
|
||||
void sub_0801D630();
|
||||
void ShowTextbox();
|
||||
void TextboxAtPosition();
|
||||
@@ -29,14 +29,13 @@ void TextboxTryNoOverlap(u32 index)
|
||||
{
|
||||
if (gRoomControls.cameraTarget != NULL) {
|
||||
TextboxNoOverlap(index, gRoomControls.cameraTarget);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ShowTextbox(index);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TextboxNoOverlap(u32 index,Entity *ent)
|
||||
void TextboxNoOverlap(u32 index, Entity* ent)
|
||||
|
||||
{
|
||||
s16 y;
|
||||
@@ -46,29 +45,26 @@ void TextboxNoOverlap(u32 index,Entity *ent)
|
||||
|
||||
y = ent->y.HALF.HI;
|
||||
h = ent->height.HALF.HI;
|
||||
|
||||
|
||||
if (88 < ((y + h) - gRoomControls.roomScrollY)) {
|
||||
gTextBox.textWindowPosY = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_080563C8(u32 param_1,u32 param_2)
|
||||
{
|
||||
TextboxAtPosition(param_1,1,param_2);
|
||||
void sub_080563C8(u32 param_1, u32 param_2) {
|
||||
TextboxAtPosition(param_1, 1, param_2);
|
||||
return;
|
||||
}
|
||||
|
||||
void TextboxAtPosition(u32 index,u32 x,u32 y)
|
||||
{
|
||||
void TextboxAtPosition(u32 index, u32 x, u32 y) {
|
||||
ShowTextbox(index);
|
||||
gTextBox.textWindowPosX = x;
|
||||
gTextBox.textWindowPosY = y;
|
||||
return;
|
||||
}
|
||||
|
||||
void ShowTextbox(u32 index,u32 param_2,u32 *dest)
|
||||
{
|
||||
void ShowTextbox(u32 index, u32 param_2, u32* dest) {
|
||||
sub_0801D630(&gTextBox, 32, dest);
|
||||
gTextBox.textIndex = index;
|
||||
gTextBox.textSpeed = 99;
|
||||
@@ -80,13 +76,12 @@ void ShowTextbox(u32 index,u32 param_2,u32 *dest)
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08056418(void)
|
||||
{
|
||||
void sub_08056418(void) {
|
||||
|
||||
sub_0801D630(&gTextBox,32);
|
||||
sub_0801D630(&gUnk_02022780,168);
|
||||
sub_0801D630(&gUnk_02036A40,8);
|
||||
sub_0801D630(&gUnk_02036A38,8);
|
||||
sub_0801D630(&gUnk_02000040,4);
|
||||
sub_0801D630(&gTextBox, 32);
|
||||
sub_0801D630(&gUnk_02022780, 168);
|
||||
sub_0801D630(&gUnk_02036A40, 8);
|
||||
sub_0801D630(&gUnk_02036A38, 8);
|
||||
sub_0801D630(&gUnk_02000040, 4);
|
||||
return;
|
||||
}
|
||||
|
||||
+8
-11
@@ -9,30 +9,27 @@ void DeleteThisEntity();
|
||||
|
||||
extern Entity gLinkEntity;
|
||||
extern RoomControls gRoomControls;
|
||||
extern void (*gUnk_08124C08[])(Entity *);
|
||||
extern void (*gUnk_08124C08[])(Entity*);
|
||||
|
||||
void sub_080A0E98(Entity* ent)
|
||||
{
|
||||
void sub_080A0E98(Entity* ent) {
|
||||
gUnk_08124C08[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_080A0EB0(Entity* ent)
|
||||
{
|
||||
void sub_080A0EB0(Entity* ent) {
|
||||
u32 tilePos;
|
||||
|
||||
ent->action = 1;
|
||||
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);
|
||||
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) |
|
||||
((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);
|
||||
ent->field_0x80 = tilePos;
|
||||
SetTile(16509, ent->field_0x80, 1);
|
||||
}
|
||||
|
||||
void sub_080A0EF0(Entity* ent)
|
||||
{
|
||||
void sub_080A0EF0(Entity* ent) {
|
||||
s32 tileIndex;
|
||||
|
||||
|
||||
tileIndex = GetTileType(ent->field_0x80, 1);
|
||||
if (tileIndex != 16509)
|
||||
{
|
||||
if (tileIndex != 16509) {
|
||||
sub_08078B48();
|
||||
gLinkEntity.x.WORD = ent->x.WORD;
|
||||
gLinkEntity.y.HALF.HI = ent->y.HALF.HI + 4;
|
||||
|
||||
+37
-70
@@ -6,12 +6,12 @@ extern void sub_0805EA78(Entity*, u32);
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern Entity* sub_0805EB9C(u32, u32);
|
||||
extern Entity* sub_0805EB9C(u32, u32);
|
||||
void CopyPosition(Entity*, Entity*);
|
||||
void sub_08068680(Entity*, Entity*);
|
||||
void sub_08068694(Entity*, Entity*);
|
||||
extern void SetGlobalFlag(u32);
|
||||
extern Entity* CreateNPC(u32 subtype,u32 parameter1,u32 parameter2);
|
||||
extern Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2);
|
||||
u32 sub_0806EDC4(Entity* ent);
|
||||
void DeleteThisEntity(void);
|
||||
extern Entity* GetEntityByType(u32, u32);
|
||||
@@ -31,14 +31,11 @@ extern void (*gUnk_08110BD8[])(Entity* ent);
|
||||
extern u8 gUnk_02033280[];
|
||||
extern u16 gUnk_08110BE0[];
|
||||
|
||||
|
||||
void sub_08066CB4(Entity* ent)
|
||||
{
|
||||
void sub_08066CB4(Entity* ent) {
|
||||
gUnk_08110BD8[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_08066CCC(Entity *ent)
|
||||
{
|
||||
void sub_08066CCC(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
sub_0805EA78(ent, 7);
|
||||
@@ -46,42 +43,34 @@ void sub_08066CCC(Entity *ent)
|
||||
sub_0807DD50(ent);
|
||||
}
|
||||
|
||||
void sub_08066CF8(Entity* ent)
|
||||
{
|
||||
void sub_08066CF8(Entity* ent) {
|
||||
sub_0807DD94(ent, 0);
|
||||
}
|
||||
|
||||
void sub_08066D04(Entity* ent)
|
||||
{
|
||||
void sub_08066D04(Entity* ent) {
|
||||
ent->parent = sub_0805EB9C(7, 0x2E);
|
||||
}
|
||||
|
||||
void sub_08066D14(Entity* ent, u32* param_2)
|
||||
{
|
||||
void sub_08066D14(Entity* ent, u32* param_2) {
|
||||
Entity* parent;
|
||||
|
||||
|
||||
parent = ent->parent;
|
||||
if (parent != NULL)
|
||||
{
|
||||
if (parent != NULL) {
|
||||
ent->animationState = parent->animationState;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
CopyPosition(parent, ent);
|
||||
sub_08068680(ent, ent->parent);
|
||||
param_2[5] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
param_2[5] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066D4C(Entity* ent, u32* param_2)
|
||||
{
|
||||
void sub_08066D4C(Entity* ent, u32* param_2) {
|
||||
Entity* parent;
|
||||
|
||||
parent = ent->parent;
|
||||
if (ent->parent != NULL)
|
||||
{
|
||||
if (ent->parent != NULL) {
|
||||
CopyPosition(ent, parent);
|
||||
ent->parent->spriteSettings.b.ss0 = 1;
|
||||
ent->parent->animationState = ent->animationState;
|
||||
@@ -89,22 +78,18 @@ void sub_08066D4C(Entity* ent, u32* param_2)
|
||||
ent->field_0x17 &= 0xFE;
|
||||
sub_08068694(ent, ent->parent);
|
||||
param_2[5] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
param_2[5] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066D94(Entity* ent)
|
||||
{
|
||||
void sub_08066D94(Entity* ent) {
|
||||
u32 roomID;
|
||||
Entity* npc;
|
||||
|
||||
|
||||
SetGlobalFlag(0x1C);
|
||||
npc = CreateNPC(0x2E, 0, 0);
|
||||
if (npc != NULL)
|
||||
{
|
||||
if (npc != NULL) {
|
||||
npc->animationState = gLinkEntity.animationState;
|
||||
npc->flags |= 0x20;
|
||||
npc->animationState = sub_0806EDC4(ent);
|
||||
@@ -115,60 +100,50 @@ void sub_08066D94(Entity* ent)
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_08066DE4(Entity* ent)
|
||||
{
|
||||
void sub_08066DE4(Entity* ent) {
|
||||
Entity* pEVar1;
|
||||
|
||||
|
||||
pEVar1 = sub_0805EB9C(7, 0x2E);
|
||||
if (pEVar1 != NULL)
|
||||
{
|
||||
if (pEVar1 != NULL) {
|
||||
CopyPosition(ent, pEVar1);
|
||||
sub_080686C4(ent, pEVar1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066E08(Entity* ent)
|
||||
{
|
||||
void sub_08066E08(Entity* ent) {
|
||||
LoadAnimation(ent, 0x50);
|
||||
ent->field_0x80 = ent->field_0x58;
|
||||
}
|
||||
|
||||
void sub_08066E20(Entity* ent)
|
||||
{
|
||||
void sub_08066E20(Entity* ent) {
|
||||
LoadAnimation(ent, 0x44);
|
||||
ent->field_0x80 = ent->field_0x58;
|
||||
}
|
||||
|
||||
void sub_08066E38(Entity* ent)
|
||||
{
|
||||
void sub_08066E38(Entity* ent) {
|
||||
LoadAnimation(ent, 0x48);
|
||||
ent->field_0x80 = ent->field_0x58;
|
||||
}
|
||||
|
||||
void sub_08066E50(Entity* ent)
|
||||
{
|
||||
void sub_08066E50(Entity* ent) {
|
||||
LoadAnimation(ent, 0x4C);
|
||||
ent->field_0x80 = ent->field_0x58;
|
||||
}
|
||||
|
||||
void sub_08066E68(Entity* ent)
|
||||
{
|
||||
void sub_08066E68(Entity* ent) {
|
||||
LoadAnimation(ent, 0x54);
|
||||
ent->field_0x80 = ent->field_0x58;
|
||||
}
|
||||
|
||||
void sub_08066E80(Entity* ent, u8* param_2)
|
||||
{
|
||||
switch(param_2[0x18])
|
||||
{
|
||||
void sub_08066E80(Entity* ent, u8* param_2) {
|
||||
switch (param_2[0x18]) {
|
||||
case 0:
|
||||
param_2[0x18]++;
|
||||
LoadAnimation(ent, 0x16);
|
||||
break;
|
||||
case 1:
|
||||
sub_080042B8(ent);
|
||||
if (ent->frames.all & 1)
|
||||
{
|
||||
if (ent->frames.all & 1) {
|
||||
param_2[0x18]++;
|
||||
ent->field_0x20 = 0x20000;
|
||||
ent->frames.all &= 0xFE;
|
||||
@@ -178,28 +153,24 @@ void sub_08066E80(Entity* ent, u8* param_2)
|
||||
case 2:
|
||||
sub_0806F62C(ent, 0x100, 0x80);
|
||||
sub_08003FC4(ent, 0x2000);
|
||||
if (!(ent->frames.all & 1))
|
||||
{
|
||||
if (!(ent->frames.all & 1)) {
|
||||
sub_080042B8(ent);
|
||||
}
|
||||
if (ent->field_0x20 < 0)
|
||||
{
|
||||
if (ent->field_0x20 < 0) {
|
||||
param_2[0x18]++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
sub_0806F62C(ent, 0x100, 0x80);
|
||||
sub_080042B8(ent);
|
||||
if (sub_08003FC4(ent, 0x2000) == 0)
|
||||
{
|
||||
if (sub_08003FC4(ent, 0x2000) == 0) {
|
||||
param_2[0x18]++;
|
||||
LoadAnimation(ent, 0x1E);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
sub_080042B8(ent);
|
||||
if (ent->frames.b.f3)
|
||||
{
|
||||
if (ent->frames.b.f3) {
|
||||
gUnk_02033280[7] |= 1;
|
||||
return;
|
||||
}
|
||||
@@ -208,28 +179,24 @@ void sub_08066E80(Entity* ent, u8* param_2)
|
||||
gUnk_02033280[6] = 0;
|
||||
}
|
||||
|
||||
void sub_08066F94(void)
|
||||
{
|
||||
void sub_08066F94(void) {
|
||||
u16 uVar1;
|
||||
u16* puVar2;
|
||||
|
||||
|
||||
puVar2 = gUnk_08110BE0;
|
||||
while (*puVar2 != 0)
|
||||
{
|
||||
while (*puVar2 != 0) {
|
||||
uVar1 = *puVar2;
|
||||
puVar2++;
|
||||
SetTileType(16498, uVar1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066FB8(void)
|
||||
{
|
||||
void sub_08066FB8(void) {
|
||||
u16 uVar1;
|
||||
u16* puVar2;
|
||||
|
||||
|
||||
puVar2 = gUnk_08110BE0;
|
||||
while (*puVar2 != 0)
|
||||
{
|
||||
while (*puVar2 != 0) {
|
||||
uVar1 = *puVar2;
|
||||
puVar2++;
|
||||
sub_0807BA8C(uVar1, 1);
|
||||
|
||||
Reference in New Issue
Block a user