match battle/area_kmr_part_1/battles.c

This commit is contained in:
Alex Bates 2020-12-27 12:11:14 +00:00
parent 2793aecebe
commit 67d0f32c8f
10 changed files with 225 additions and 53 deletions

View File

@ -237,14 +237,14 @@ typedef struct Enemy {
/* 0xDC */ char unk_DC[20];
} Enemy; // size = 0xF0
/// Zero-terminated.
typedef struct {
/* 0x00 */ s32 npcCount;
/* 0x04 */ StaticNpc* npcs;
/* 0x08 */ FormationID formationID;
/* 0x08 */ BattleID battle;
} NpcGroupList[]; // size = 0x0C
#define NPC_GROUP(npcs, formationID) { sizeof(npcs) / sizeof(StaticNpc), &npcs, formationID }
#define NPC_GROUP_LIST_END() { 0, 0, 0 }
#define NPC_GROUP(npcs, battle) { sizeof(npcs) / sizeof(StaticNpc), &npcs, battle }
Enemy* get_enemy(NpcId npcId);
MapConfig* get_current_map_header(void);

View File

@ -10,8 +10,8 @@
#define UNK_FUN_PTR(name) void(*name)(void)
#define UNK_ARGS
typedef s32 FormationID;
#define FORMATION_ID(section, stage, index) ((section << 16) + (stage << 8) + index)
typedef s32 BattleID;
#define BATTLE_ID(area, stage, index) ((area << 16) + (stage << 8) + index)
typedef s32 NpcAnimID;
#define NPC_ANIM(sprite, palette, anim) ((_NPC_SPRITE_##sprite << 16) + (_NPC_PALETTE_##sprite##_##palette << 8) + _NPC_ANIM_##sprite##_##anim)

View File

@ -0,0 +1,7 @@
#ifndef _BATTLE_ACTOR_GOOMBA_
#define _BATTLE_ACTOR_GOOMBA_
// TODO: disasm
#define goomba 0x802196EC
#endif

View File

@ -0,0 +1,7 @@
#ifndef _BATTLE_ACTOR_PARAGOOMBA_
#define _BATTLE_ACTOR_PARAGOOMBA_
// TODO: disasm
#define paragoomba 0x8021CD00
#endif

View File

@ -0,0 +1,7 @@
#ifndef _BATTLE_ACTOR_SPIKED_GOOMBA_
#define _BATTLE_ACTOR_SPIKED_GOOMBA_
// TODO: disasm
#define spikedGoomba 0x8021B0AC
#endif

View File

@ -0,0 +1,94 @@
#include "common.h"
#include "battle/battle.h"
#include "battle/actor/goomba.h"
#include "battle/actor/paragoomba.h"
#include "battle/actor/spiked_goomba.h"
Formation formation0 = {
{ goomba, .position = 1, .priority = 10 },
};
Formation formation1 = {
{ goomba, .position = 1, .priority = 10 },
{ goomba, .position = 2, .priority = 9 },
};
Formation formation2 = {
{ goomba, .position = 0, .priority = 10 },
{ goomba, .position = 1, .priority = 9 },
{ goomba, .position = 2, .priority = 8 },
};
Formation formation3 = {
{ goomba, .position = 1, .priority = 10 },
{ paragoomba, .position = 6, .priority = 9 },
};
Formation formation4 = {
{ goomba, .position = 0, .priority = 10 },
{ goomba, .position = 1, .priority = 9 },
{ goomba, .position = 2, .priority = 8 },
{ goomba, .position = 3, .priority = 7 },
};
Formation formation5 = {
{ goomba, .position = 1, .priority = 10 },
{ spikedGoomba, .position = 2, .priority = 9 },
};
Formation formation6 = {
{ goomba, .position = 0, .priority = 10 },
{ paragoomba, .position = 5, .priority = 9 },
{ goomba, .position = 2, .priority = 8 },
{ paragoomba, .position = 7, .priority = 7 },
};
Formation formation7 = {
{ paragoomba, .position = 5, .priority = 10 },
};
Formation formation8 = {
{ paragoomba, .position = 5, .priority = 10 },
{ paragoomba, .position = 6, .priority = 9 },
};
Formation formation9 = {
{ paragoomba, .position = 4, .priority = 10 },
{ paragoomba, .position = 5, .priority = 9 },
{ paragoomba, .position = 6, .priority = 8 },
};
Formation formation10 = {
{ spikedGoomba, .position = 1, .priority = 10 },
};
Formation formation11 = {
{ spikedGoomba, .position = 1, .priority = 10 },
{ goomba, .position = 2, .priority = 9 },
};
BattleList area_kmr_part_1_battles = {
BATTLE("クリボー", formation0, 0x8022066C),
BATTLE("クリボーx", formation1, 0x8022066C),
BATTLE("クリボーx", formation2, 0x8022066C),
BATTLE("クリボー、パタクリボー", formation3, 0x8022066C),
BATTLE("クリボーx", formation4, 0x8022066C),
BATTLE("クリボー,トゲクリボー", formation5, 0x8022066C),
BATTLE("クリボー,パタクリボー,クリボー,パタクリボー", formation6, 0x8022066C),
BATTLE("パタクリボー", formation7, 0x8022066C),
BATTLE("パタクリボーx", formation8, 0x8022066C),
BATTLE("パタクリボーx", formation9, 0x8022066C),
BATTLE("トゲクリボー", formation10, 0x8022066C),
BATTLE("トゲクリボー、クリボー", formation11, 0x8022066C),
{},
};
StageList area_kmr_part_1_stages = {
{ "kmr_02", 0x8021FDD0 },
{ "kmr_03", 0x8022021C },
{ "kmr_04", 0x8022066C },
{ "kmr_05", 0x80220A78 },
{ "kmr_06", 0x80220ECC },
{},
};

View File

@ -1,13 +1,14 @@
#include "common.h"
#include "ld_addrs.h"
#include "battle.h"
typedef struct BattleArea {
/* 0x00 */ char* name; ///< JP debug name.
/* 0x04 */ s32 dmaStart;
/* 0x08 */ s32 dmaEnd;
/* 0x0C */ void* dmaDest;
/* 0x10 */ void* formations;
/* 0x14 */ void* stages;
/* 0x10 */ BattleList* battles;
/* 0x14 */ StageList* stages;
/* 0x18 */ s32 unused_18;
/* 0x1C */ void* dmaTable;
} BattleArea; // size = 0x20
@ -84,246 +85,249 @@ const s32 rodata_75240[] = {
/* 0x75630 */ 0x08080808, 0x08080808, 0x08080808, 0x08080808,
};
BattleList area_kmr_part_1_battles;
StageList area_kmr_part_1_stages;
BattleArea gBattleAreas[0x30] = {
{
AREA(area_kmr_part_1),
.name = "エリア その1",
.formations = 0x802194D4,
.stages = 0x802195D8,
.battles = area_kmr_part_1_battles,
.stages = area_kmr_part_1_stages,
},
{
AREA(area_kmr_part_2),
.name = "エリア その2",
.formations = 0x80219840,
.battles = 0x80219840,
.stages = 0x8021987C,
},
{
AREA(area_kmr_part_3),
.name = "エリア その3",
.formations = 0x8021A2AC,
.battles = 0x8021A2AC,
.stages = 0x8021A360,
},
{
AREA(area_mac),
.name = "エリア ",
.formations = 0x80232A5C,
.battles = 0x80232A5C,
.stages = 0x80232AD4,
},
{
AREA(area_hos),
.name = "エリア ",
.formations = 0x80225F24,
.battles = 0x80225F24,
.stages = 0x80225F88,
},
{
AREA(area_nok),
.name = "エリア ",
.formations = 0x80219520,
.battles = 0x80219520,
.stages = 0x80219728,
},
{
AREA(area_trd_part_1),
.name = "エリア その1",
.formations = 0x80218CB0,
.battles = 0x80218CB0,
.stages = 0x80218EE0,
},
{
AREA(area_trd_part_2),
.name = "エリア その2",
.formations = 0x8021A5DC,
.battles = 0x8021A5DC,
.stages = 0x8021A604,
},
{
AREA(area_trd_part_3),
.name = "エリア その3",
.formations = 0x8021823C,
.battles = 0x8021823C,
.stages = 0x80218264,
},
{
AREA(area_iwa),
.name = "エリア ",
.formations = 0x802185B8,
.battles = 0x802185B8,
.stages = 0x802186E4,
},
{
AREA(area_sbk),
.name = "エリア ",
.formations = 0x8021FE80,
.battles = 0x8021FE80,
.stages = 0x8021FFE8,
},
{
AREA(area_isk_part_1),
.name = "エリア その1",
.formations = 0x80224700,
.battles = 0x80224700,
.stages = 0x802248A4,
},
{
AREA(area_isk_part_2),
.name = "エリア その2",
.formations = 0x80220448,
.battles = 0x80220448,
.stages = 0x80220470,
},
{
AREA(area_mim),
.name = "エリア ",
.formations = 0x8021EA70,
.battles = 0x8021EA70,
.stages = 0x8021EBEC,
},
{
AREA(area_arn),
.name = "エリア ",
.formations = 0x80228110,
.battles = 0x80228110,
.stages = 0x80228278,
},
{
AREA(area_dgb),
.name = "エリア ",
.formations = 0x8021B38C,
.battles = 0x8021B38C,
.stages = 0x8021B418,
},
{
AREA(area_omo),
.name = "エリア ",
.formations = 0x80230730,
.battles = 0x80230730,
.stages = 0x80230AC8,
},
{
AREA(area_omo2),
.name = "エリア ",
.formations = 0x8022FBF4,
.battles = 0x8022FBF4,
.stages = 0x8022FC1C,
},
{
AREA(area_omo3),
.name = "エリア ",
.formations = 0x8022EA2C,
.battles = 0x8022EA2C,
.stages = 0x8022EB1C,
},
{
AREA(area_kgr),
.name = "エリア ",
.formations = 0x8021D5FC,
.battles = 0x8021D5FC,
.stages = 0x8021D624,
},
{
AREA(area_jan),
.name = "エリア ",
.formations = 0x80228AF8,
.battles = 0x80228AF8,
.stages = 0x80228C60,
},
{
AREA(area_jan2),
.name = "エリア ",
.formations = 0x8021F6C8,
.battles = 0x8021F6C8,
.stages = 0x8021F72C,
},
{
AREA(area_kzn),
.name = "エリア ",
.formations = 0x80229E74,
.battles = 0x80229E74,
.stages = 0x8022A02C,
},
{
AREA(area_kzn2),
.name = "エリア ",
.formations = 0x8022AA08,
.battles = 0x8022AA08,
.stages = 0x8022AA44,
.dmaTable = 0x8022AA84,
},
{
AREA(area_flo),
.name = "エリア ",
.formations = 0x80234574,
.battles = 0x80234574,
.stages = 0x8023486C,
},
{
AREA(area_flo2),
.name = "エリア ",
.formations = 0x802356FC,
.battles = 0x802356FC,
.stages = 0x80235788,
},
{
AREA(area_tik),
.name = "エリア ",
.formations = 0x802340B4,
.battles = 0x802340B4,
.stages = 0x802342BC,
},
{
AREA(area_tik2),
.name = "エリア ",
.formations = 0x80227A90,
.battles = 0x80227A90,
.stages = 0x80227AE0,
},
{
AREA(area_tik3),
.name = "エリア ",
.formations = 0x802232E8,
.battles = 0x802232E8,
.stages = 0x8022334C,
},
{
AREA(area_sam),
.name = "エリア ",
.formations = 0x80231164,
.battles = 0x80231164,
.stages = 0x80231290,
},
{
AREA(area_sam2),
.name = "エリア ",
.formations = 0x802234F0,
.battles = 0x802234F0,
.stages = 0x8022352C,
},
{
AREA(area_pra),
.name = "エリア ",
.formations = 0x8022F4D4,
.battles = 0x8022F4D4,
.stages = 0x8022F614,
},
{
AREA(area_pra2),
.name = "エリア ",
.formations = 0x802215A0,
.battles = 0x802215A0,
.stages = 0x802215C8,
},
{
AREA(area_pra3),
.name = "エリア ",
.formations = 0x80232888,
.battles = 0x80232888,
.stages = 0x8023298C,
},
{
AREA(area_kpa),
.name = "エリア ",
.formations = 0x80231A64,
.battles = 0x80231A64,
.stages = 0x80231ED8,
},
{
AREA(area_kpa2),
.name = "エリア ",
.formations = 0x802346A8,
.battles = 0x802346A8,
.stages = 0x80234720,
},
{
AREA(area_kpa3),
.name = "エリア ",
.formations = 0x8022839C,
.battles = 0x8022839C,
.stages = 0x802283EC,
},
{
AREA(area_kpa4),
.name = "エリア ",
.formations = 0x80227910,
.battles = 0x80227910,
.stages = 0x80227988,
},
{
AREA(area_kkj),
.name = "エリア ",
.formations = 0x802185BC,
.battles = 0x802185BC,
.stages = 0x802185E4,
},
{
AREA(area_dig),
.name = "エリア ",
.formations = 0x8022A7C4,
.battles = 0x8022A7C4,
.stages = 0x8022A83C,
},
{},

48
src/battle/battle.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef _BATTLE_BATTLE_H_
#define _BATTLE_BATTLE_H_
#include "common.h"
typedef struct Stage {
/* 0x00 */ const char* texture;
/* 0x04 */ const char* shape;
/* 0x08 */ const char* hit;
/* 0x0C */ Bytecode* preBattle;
/* 0x10 */ Bytecode* postBattle;
/* 0x14 */ const char* bg;
/* 0x18 */ s32 unk_18;
/* 0x1C */ s32 unk_1C;
/* 0x20 */ s32 unk_20;
/* 0x24 */ s32 unk_24;
} Stage; // size = 0x28
/// Zero-terminated.
typedef struct StageListRow {
/* 0x00 */ const char* id; ///< Map ID.
/* 0x04 */ Stage* stage;
} StageList[]; // size = 0x08 * n
typedef struct FormationRow {
/* 0x00 */ StaticActorData* actor;
/* 0x04 */ s32 position; ///< Home position. May also be a `Vector3*`.
/* 0x08 */ s32 priority; ///< Actors with higher priority values take their turn first.
/* 0x0C */ s32 var0;
/* 0x10 */ s32 var1;
/* 0x14 */ s32 var2;
/* 0x18 */ s32 var3;
} Formation[]; // size = 0x1C * n
/// Zero-terminated.
typedef struct Battle {
/* 0x00 */ const char* name; ///< Debug SJIS name.
/* 0x04 */ s32 formationSize;
/* 0x08 */ Formation* formation;
/* 0x0C */ Stage* stage;
/* 0x10 */ s32 unk_10;
} BattleList[]; // size = 0x14 * n
#define BATTLE(name, formation, stage) { name, ARRAY_COUNT(formation), formation, stage }
// TODO: enum for home position (0..3 are floor, 4..7 are air, etc.)
#endif

View File

@ -187,8 +187,8 @@ StaticNpc M(goombaNpc) = {
};
NpcGroupList M(npcGroupList) = {
NPC_GROUP(M(goombaNpc), FORMATION_ID(1, 0, 3)),
NPC_GROUP_LIST_END(),
NPC_GROUP(M(goombaNpc), BATTLE_ID(1, 0, 3)),
{},
};
Script M(ReadEastSign) = SCRIPT({

View File

@ -907,8 +907,10 @@ segments:
overlay: True
files:
- [0x4309A0, c]
- [0x431B80, bin]
- [0x4398A0, bin]
- [0x431B80, .data, battle/area_kmr_part_1/battles]
- [0x431FB0, bin, battle/area_kmr_part_1/goomba]
- [0x4398A0, .rodata, battle/area_kmr_part_1/battles]
- [0x439984, bin]
- name: battle/area_kmr_part_2/
type: code
start: 0x439A90
@ -978,7 +980,10 @@ segments:
vram: 0x80218000
overlay: True
files:
- [0x4DA5E0, bin]
- [0x4DA5E0, bin] # 1 func
- [0x4DA6B0, bin] # 2 funcs
- [0x4DA860, bin] # data
- [0x4E25E0, bin] # rodata
- name: battle/area_isk_part_1/
type: code
start: 0x4E2740