mirror of
https://github.com/pret/pokeruby.git
synced 2025-03-03 02:25:34 +00:00
various fixes before merge
This commit is contained in:
parent
5891cedc1b
commit
f5e9d5be60
@ -21,8 +21,8 @@
|
||||
|
||||
#define AI_ACTION_DONE 0x0001
|
||||
#define AI_ACTION_FLEE 0x0002
|
||||
#define AI_ACTION_WATCH 0x0004
|
||||
#define AI_ACTION_DO_NOT_ATTACK 0x0008
|
||||
#define AI_ACTION_WATCH 0x0004
|
||||
#define AI_ACTION_DO_NOT_ATTACK 0x0008
|
||||
#define AI_ACTION_UNK5 0x0010
|
||||
#define AI_ACTION_UNK6 0x0020
|
||||
#define AI_ACTION_UNK7 0x0040
|
||||
@ -62,7 +62,7 @@
|
||||
#define STATUS3_ON_AIR 0x40
|
||||
#define STATUS3_UNDERGROUND 0x80
|
||||
#define STATUS3_MINIMIZED 0x100
|
||||
#define STATUS3_ROOTED 0x400
|
||||
#define STATUS3_ROOTED 0x400
|
||||
#define STATUS3_CHARGED_UP 0x200
|
||||
#define STATUS3_YAWN 0x1800 //two bits
|
||||
#define STATUS3_IMPRISIONED 0x2000
|
||||
@ -97,44 +97,33 @@
|
||||
#define HITMARKER_FAINTED(bank) ((gBitTable[bank] << 0x1C))
|
||||
#define HITMARKER_UNK(bank) ((0x10000000 << bank))
|
||||
|
||||
#define SIDE_REFLECT 0x1
|
||||
#define SIDE_LIGHTSCREEN 0x2
|
||||
#define SIDE_SPIKES 0x10
|
||||
#define SIDE_SAFEGUARD 0x20
|
||||
#define SIDE_FUTUREATTACK 0x40
|
||||
#define SIDE_MIST 0x100
|
||||
#define SIDE_SPIKES_DMG_DONE 0x200
|
||||
#define SIDE_STATUS_REFLECT (1 << 0)
|
||||
#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
|
||||
#define SIDE_STATUS_SPIKES (1 << 4)
|
||||
#define SIDE_STATUS_SAFEGUARD (1 << 5)
|
||||
#define SIDE_STATUS_FUTUREATTACK (1 << 6)
|
||||
#define SIDE_STATUS_MIST (1 << 8)
|
||||
#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
|
||||
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
#define MAX_MON_MOVES 4
|
||||
#define MAX_BANKS_BATTLE 4
|
||||
|
||||
#define weather_rain 1
|
||||
#define weather_downpour 2
|
||||
#define weather_permament_rain 4
|
||||
#define WEATHER_RAINY ((weather_rain | weather_downpour | weather_permament_rain))
|
||||
|
||||
#define weather_sandstorm 8
|
||||
#define weather_permament_sandstorm 0x10
|
||||
#define WEATHER_SANDSTORMY ((weather_sandstorm | weather_permament_sandstorm))
|
||||
|
||||
#define weather_sun 0x20
|
||||
#define weather_permament_sun 0x40
|
||||
#define WEATHER_SUNNY ((weather_sun | weather_permament_sun))
|
||||
|
||||
#define weather_hail 0x80
|
||||
#define WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1)
|
||||
#define WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
#define WEATHER_RAIN_ANY ((WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT))
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
|
||||
#define WEATHER_SANDSTORM_ANY ((WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT))
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 5)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 6)
|
||||
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
|
||||
#define WEATHER_HAIL (1 << 7)
|
||||
|
||||
// needed to match the hack that is get_item, thanks cam, someone else clean this up later.
|
||||
extern u8 unk_2000000[];
|
||||
|
||||
enum
|
||||
{
|
||||
WEATHER_SUN,
|
||||
WEATHER_RAIN,
|
||||
WEATHER_SANDSTORM,
|
||||
WEATHER_HAIL,
|
||||
};
|
||||
|
||||
struct Trainer
|
||||
{
|
||||
/*0x00*/ u8 partyFlags;
|
||||
@ -398,7 +387,7 @@ struct BattleResults
|
||||
u16 caughtPoke; // 0x28
|
||||
u8 caughtNick[10]; // 0x2A
|
||||
u8 filler34[2];
|
||||
u8 unk36[10];
|
||||
u8 unk36[10]; // usedBalls?
|
||||
};
|
||||
|
||||
struct Struct2017800
|
||||
@ -548,10 +537,10 @@ extern u8 ewram[];
|
||||
#define UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *) (ewram + 0x16A00))
|
||||
#define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00))
|
||||
#define AI_ARRAY_160CC ((struct SmallItemStruct *) (ewram + 0x160CC))
|
||||
#define B_FUNCTION_STACK ((struct funcStack *) (ewram + 0x17140))
|
||||
#define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800))
|
||||
#define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810))
|
||||
#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840))
|
||||
#define B_FUNCTION_STACK ((struct funcStack *)(0x02017140))
|
||||
|
||||
struct funcStack
|
||||
{
|
||||
|
@ -349,6 +349,18 @@ struct BattlePokemon
|
||||
/*0x54*/ u32 otId;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
STAT_STAGE_HP, // 0
|
||||
STAT_STAGE_ATK, // 1
|
||||
STAT_STAGE_DEF, // 2
|
||||
STAT_STAGE_SPEED, // 3
|
||||
STAT_STAGE_SPATK, // 4
|
||||
STAT_STAGE_SPDEF, // 5
|
||||
STAT_STAGE_ACC, // 6
|
||||
STAT_STAGE_EVASION, // 7
|
||||
};
|
||||
|
||||
struct BaseStats
|
||||
{
|
||||
/*0x00*/ u8 baseHP;
|
||||
|
@ -24,15 +24,16 @@ void EmitFaintAnimation(u8 a);
|
||||
void dp01_build_cmdbuf_x0B_B_B_B(u8 a);
|
||||
void dp01_build_cmdbuf_x0C_C_C_C(u8 a);
|
||||
void EmitBallThrowAnim(u8 a, u8 b);
|
||||
void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, u8 *g);
|
||||
void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, struct DisableStruct *g);
|
||||
void EmitPrintString(u8 a, u16 b);
|
||||
void EmitPrintStringPlayerOnly(u8 a, u16 stringID);
|
||||
void dp01_build_cmdbuf_x12_a_bb(u8 a, u8 b, u16 c);
|
||||
void sub_800CBA4(u8 a, u8 b, u8 c, u8 *d);
|
||||
void sub_800CBE0(u8 a, u8 *b);
|
||||
void EmitChoosePokemon(u8 a, u8 b, u8 c, u8 d, u8 *e);
|
||||
void dp01_build_cmdbuf_x17_17_17_17(u8 a);
|
||||
void EmitHealthBarUpdate(u8 a, s16 b);
|
||||
void EmitExpBarUpdate(u8 a, u8 b, s16 c);
|
||||
void EmitHealthBarUpdate(u8 a, u16 b);
|
||||
void EmitExpBarUpdate(u8 a, u8 b, u16 c);
|
||||
void EmitStatusIconUpdate(u8 a, u32 b, u32 c);
|
||||
void EmitStatusAnimation(u8 a, u8 b, u32 c);
|
||||
void EmitStatusXor(u8 a, u8 b);
|
||||
|
1778
src/battle_4.c
1778
src/battle_4.c
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,14 @@ extern u8 gCritMultiplier;
|
||||
extern u16 gTrainerBattleOpponent;
|
||||
extern u8 *BattleAIs[];
|
||||
|
||||
enum
|
||||
{
|
||||
WEATHER_TYPE_SUN,
|
||||
WEATHER_TYPE_RAIN,
|
||||
WEATHER_TYPE_SANDSTORM,
|
||||
WEATHER_TYPE_HAIL,
|
||||
};
|
||||
|
||||
/*
|
||||
gAIScriptPtr is a pointer to the next battle AI cmd command to read.
|
||||
when a command finishes processing, gAIScriptPtr is incremented by
|
||||
@ -1562,14 +1570,14 @@ static void BattleAICmd_if_status_not_in_party(void)
|
||||
|
||||
static void BattleAICmd_get_weather(void)
|
||||
{
|
||||
if (gBattleWeather & WEATHER_RAINY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_RAIN;
|
||||
if (gBattleWeather & WEATHER_SANDSTORMY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_SANDSTORM;
|
||||
if (gBattleWeather & WEATHER_SUNNY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_SUN;
|
||||
if (gBattleWeather & weather_hail)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_HAIL;
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_RAIN;
|
||||
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_SANDSTORM;
|
||||
if (gBattleWeather & WEATHER_SUN_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_SUN;
|
||||
if (gBattleWeather & WEATHER_HAIL)
|
||||
AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_HAIL;
|
||||
|
||||
gAIScriptPtr += 1;
|
||||
}
|
||||
|
24
src/rom3.c
24
src/rom3.c
@ -1,5 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "rom3.h"
|
||||
#include "battle.h"
|
||||
#include "battle_811DA74.h"
|
||||
#include "battle_ai.h"
|
||||
@ -10,6 +9,7 @@
|
||||
#include "items.h"
|
||||
#include "link.h"
|
||||
#include "pokemon.h"
|
||||
#include "rom3.h"
|
||||
#include "rom_8094928.h"
|
||||
#include "species.h"
|
||||
#include "task.h"
|
||||
@ -703,7 +703,7 @@ void unref_sub_800C828(u8 a, u8 b, u8 *c)
|
||||
dp01_prepare_buffer(a, gBattleBuffersTransferData, b * 3 + 2);
|
||||
}
|
||||
|
||||
void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, u8 *g)
|
||||
void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, struct DisableStruct *g)
|
||||
{
|
||||
gBattleBuffersTransferData[0] = 15;
|
||||
gBattleBuffersTransferData[1] = b;
|
||||
@ -729,7 +729,7 @@ void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, u8 *g)
|
||||
}
|
||||
gBattleBuffersTransferData[14] = 0;
|
||||
gBattleBuffersTransferData[15] = 0;
|
||||
memcpy(&gBattleBuffersTransferData[16], g, 0x1C);
|
||||
memcpy(&gBattleBuffersTransferData[16], g, sizeof(*g));
|
||||
dp01_prepare_buffer(a, gBattleBuffersTransferData, 0x2C);
|
||||
}
|
||||
|
||||
@ -906,7 +906,7 @@ _0800CA64: .4byte gBattleTextBuff1\n\
|
||||
#endif
|
||||
|
||||
__attribute__((naked))
|
||||
void EmitPrintStringPlayerOnly()
|
||||
void EmitPrintStringPlayerOnly(u8 a, u16 stringID)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
@ -1082,21 +1082,25 @@ void dp01_build_cmdbuf_x17_17_17_17(u8 a)
|
||||
dp01_prepare_buffer(a, gBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void EmitHealthBarUpdate(u8 a, s16 b)
|
||||
// FIXME: I think this function is supposed to take s16 as its second argument,
|
||||
// but battle_4.c expects u16
|
||||
void EmitHealthBarUpdate(u8 a, u16 b)
|
||||
{
|
||||
gBattleBuffersTransferData[0] = 24;
|
||||
gBattleBuffersTransferData[1] = 0;
|
||||
gBattleBuffersTransferData[2] = b;
|
||||
gBattleBuffersTransferData[3] = (b & 0xFF00) >> 8;
|
||||
gBattleBuffersTransferData[2] = (s16)b;
|
||||
gBattleBuffersTransferData[3] = ((s16)b & 0xFF00) >> 8;
|
||||
dp01_prepare_buffer(a, gBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void EmitExpBarUpdate(u8 a, u8 b, s16 c)
|
||||
// FIXME: I think this function is supposed to take s16 as its third argument,
|
||||
// but battle_4.c expects u16
|
||||
void EmitExpBarUpdate(u8 a, u8 b, u16 c)
|
||||
{
|
||||
gBattleBuffersTransferData[0] = 25;
|
||||
gBattleBuffersTransferData[1] = b;
|
||||
gBattleBuffersTransferData[2] = c;
|
||||
gBattleBuffersTransferData[3] = (c & 0xFF00) >> 8;
|
||||
gBattleBuffersTransferData[2] = (s16)c;
|
||||
gBattleBuffersTransferData[3] = ((s16)c & 0xFF00) >> 8;
|
||||
dp01_prepare_buffer(a, gBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user