mirror of
https://github.com/FireEmblemUniverse/fireemblem8u.git
synced 2024-11-24 05:39:45 +00:00
misc cleanup
This commit is contained in:
parent
1d6f851065
commit
3ae39637d6
@ -51,4 +51,4 @@ extern struct UnkMovMapFill gUnknown_03004C50[];
|
||||
|
||||
extern struct MovMapFillState gMovMapFillState;
|
||||
|
||||
#endif // GUARD_BMIDOTEN_H
|
||||
#endif // GUARD_BMIDOTEN_H
|
||||
|
@ -43,7 +43,7 @@ enum
|
||||
// Magic values for gBmMapMovement
|
||||
|
||||
MAP_MOVEMENT_MAX = 120,
|
||||
MAP_MOVEMENT_MAX_124 = 124, // TODO: figure out
|
||||
MAP_MOVEMENT_EXTENDED = 124,
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -276,7 +276,7 @@ enum {
|
||||
CA_MOUNTEDAID = (1 << 0),
|
||||
CA_CANTO = (1 << 1),
|
||||
CA_STEAL = (1 << 2),
|
||||
CA_LOCKPICK = (1 << 3), // TODO: rename to CA_THIEF
|
||||
CA_THIEF = (1 << 3),
|
||||
CA_DANCE = (1 << 4),
|
||||
CA_PLAY = (1 << 5),
|
||||
CA_CRITBONUS = (1 << 6),
|
||||
@ -296,15 +296,15 @@ enum {
|
||||
CA_UNSELECTABLE = (1 << 20),
|
||||
CA_TRIANGLEATTACK_PEGASI = (1 << 21),
|
||||
CA_TRIANGLEATTACK_ARMORS = (1 << 22),
|
||||
CA_BIT_23 = 0x00800000,
|
||||
CA_NEGATE_LETHALITY = 0x01000000,
|
||||
CA_LETHALITY = 0x02000000, // TODO: rename to CA_ASSASSIN
|
||||
CA_MAGICSEAL = 0x04000000,
|
||||
CA_SUMMON = 0x08000000,
|
||||
CA_LOCK_4 = 0x10000000,
|
||||
CA_LOCK_5 = 0x20000000,
|
||||
CA_LOCK_6 = 0x40000000,
|
||||
CA_LOCK_7 = 0x80000000,
|
||||
CA_BIT_23 = (1 << 23),
|
||||
CA_NEGATE_LETHALITY = (1 << 24),
|
||||
CA_ASSASSIN = (1 << 25),
|
||||
CA_MAGICSEAL = (1 << 26),
|
||||
CA_SUMMON = (1 << 27),
|
||||
CA_LOCK_4 = (1 << 28),
|
||||
CA_LOCK_5 = (1 << 29),
|
||||
CA_LOCK_6 = (1 << 30),
|
||||
CA_LOCK_7 = (1 << 31),
|
||||
|
||||
// Helpers
|
||||
CA_REFRESHER = CA_DANCE | CA_PLAY,
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "constants/items.h"
|
||||
#include "constants/classes.h"
|
||||
#include "constants/characters.h"
|
||||
#include "constants/terrains.h"
|
||||
|
||||
#include "rng.h"
|
||||
#include "bmitem.h"
|
||||
@ -680,7 +681,7 @@ void ComputeBattleUnitEffectiveCritRate(struct BattleUnit* attacker, struct Batt
|
||||
}
|
||||
|
||||
void ComputeBattleUnitSilencerRate(struct BattleUnit* attacker, struct BattleUnit* defender) {
|
||||
if (!(UNIT_CATTRIBUTES(&attacker->unit) & CA_LETHALITY))
|
||||
if (!(UNIT_CATTRIBUTES(&attacker->unit) & CA_ASSASSIN))
|
||||
attacker->battleSilencerRate = 0;
|
||||
else {
|
||||
attacker->battleSilencerRate = 50;
|
||||
@ -1765,7 +1766,7 @@ int GetUnitPowerLevel(struct Unit* unit) {
|
||||
int GetUnitClassKillExpBonus(struct Unit* actor, struct Unit* target) {
|
||||
int result = 0;
|
||||
|
||||
if (UNIT_CATTRIBUTES(target) & CA_LOCKPICK)
|
||||
if (UNIT_CATTRIBUTES(target) & CA_THIEF)
|
||||
result += 20;
|
||||
|
||||
if (UNIT_CATTRIBUTES(target) & CA_BOSS)
|
||||
@ -1780,7 +1781,7 @@ int GetUnitClassKillExpBonus(struct Unit* actor, struct Unit* target) {
|
||||
int GetUnitExpMultiplier(struct Unit* actor, struct Unit* target) {
|
||||
int i;
|
||||
|
||||
if (!(UNIT_CATTRIBUTES(actor) & CA_LETHALITY))
|
||||
if (!(UNIT_CATTRIBUTES(actor) & CA_ASSASSIN))
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < BATTLE_HIT_MAX; ++i)
|
||||
@ -2021,12 +2022,12 @@ void InitObstacleBattleUnit(void) {
|
||||
|
||||
switch (gBmMapTerrain[gBattleTarget.unit.yPos][gBattleTarget.unit.xPos]) {
|
||||
|
||||
case 0x1B: // TODO: terrain id constants
|
||||
case TERRAIN_WALL_1B:
|
||||
gBattleTarget.unit.pCharacterData = GetCharacterData(CHARACTER_WALL);
|
||||
|
||||
break;
|
||||
|
||||
case 0x33: // TODO: terrain id constants
|
||||
case TERRAIN_SNAG:
|
||||
gBattleTarget.unit.pCharacterData = GetCharacterData(CHARACTER_SNAG);
|
||||
gBattleTarget.unit.maxHP = 20;
|
||||
|
||||
@ -2054,7 +2055,7 @@ void UpdateObstacleFromBattle(struct BattleUnit* bu) {
|
||||
if (trap->data[TRAP_EXTDATA_OBSTACLE_HP] == 0) {
|
||||
int mapChangeId = GetMapChangesIdAt(bu->unit.xPos, bu->unit.yPos);
|
||||
|
||||
if (gBmMapTerrain[bu->unit.yPos][bu->unit.xPos] == 0x33) // TODO: terrain id constants
|
||||
if (gBmMapTerrain[bu->unit.yPos][bu->unit.xPos] == TERRAIN_SNAG)
|
||||
PlaySoundEffect(0x2D7); // TODO: Sound id constants
|
||||
|
||||
RenderBmMapOnBg2();
|
||||
|
@ -39,7 +39,7 @@ void GenerateUnitExtendedMovementMap(struct Unit* unit)
|
||||
SetWorkingMoveCosts(GetUnitMovementCost(unit));
|
||||
SetWorkingBmMap(gBmMapMovement);
|
||||
|
||||
GenerateMovementMap(unit->xPos, unit->yPos, MAP_MOVEMENT_MAX_124, 0);
|
||||
GenerateMovementMap(unit->xPos, unit->yPos, MAP_MOVEMENT_EXTENDED, 0);
|
||||
}
|
||||
|
||||
void GenerateExtendedMovementMapOnRange(int x, int y, const s8 mct[TERRAIN_COUNT])
|
||||
@ -47,7 +47,7 @@ void GenerateExtendedMovementMapOnRange(int x, int y, const s8 mct[TERRAIN_COUNT
|
||||
SetWorkingMoveCosts(mct);
|
||||
SetWorkingBmMap(gBmMapRange);
|
||||
|
||||
GenerateMovementMap(x, y, MAP_MOVEMENT_MAX_124, 0);
|
||||
GenerateMovementMap(x, y, MAP_MOVEMENT_EXTENDED, 0);
|
||||
}
|
||||
|
||||
void GenerateExtendedMovementMap(int x, int y, const s8 mct[TERRAIN_COUNT])
|
||||
@ -55,7 +55,7 @@ void GenerateExtendedMovementMap(int x, int y, const s8 mct[TERRAIN_COUNT])
|
||||
SetWorkingMoveCosts(mct);
|
||||
SetWorkingBmMap(gBmMapMovement);
|
||||
|
||||
GenerateMovementMap(x, y, MAP_MOVEMENT_MAX_124, 0);
|
||||
GenerateMovementMap(x, y, MAP_MOVEMENT_EXTENDED, 0);
|
||||
}
|
||||
|
||||
void GenerateMovementMapOnWorkingMap(struct Unit* unit, int x, int y, int movement)
|
||||
@ -304,7 +304,7 @@ void UnitApplyWorkingMovementScript(struct Unit* unit, int x, int y)
|
||||
|
||||
} // switch (*it)
|
||||
|
||||
if (!(UNIT_CATTRIBUTES(unit) & (CA_LOCKPICK | CA_FLYER | CA_LETHALITY)))
|
||||
if (!(UNIT_CATTRIBUTES(unit) & (CA_THIEF | CA_FLYER | CA_ASSASSIN)))
|
||||
{
|
||||
if (gBmMapHidden[y][x] & HIDDEN_BIT_TRAP)
|
||||
{
|
||||
|
@ -855,8 +855,6 @@ void WfxInit(void) {
|
||||
}
|
||||
|
||||
void WfxVSync(void) {
|
||||
// TODO: USE WEATHER DEFINITIONS
|
||||
|
||||
switch (gUnknown_0202BCF0.chapterWeatherId) {
|
||||
|
||||
case WEATHER_SNOW:
|
||||
|
@ -756,7 +756,7 @@ s8 IsItemDisplayUsable(struct Unit* unit, int item) {
|
||||
if (unit->statusIndex == UNIT_STATUS_BERSERK)
|
||||
return FALSE;
|
||||
|
||||
if (!(UNIT_CATTRIBUTES(unit) & CA_LOCKPICK) && GetItemIndex(item) == ITEM_LOCKPICK)
|
||||
if (!(UNIT_CATTRIBUTES(unit) & CA_THIEF) && GetItemIndex(item) == ITEM_LOCKPICK)
|
||||
return FALSE;
|
||||
|
||||
if (!(UNIT_CATTRIBUTES(unit) & CA_REFRESHER) && IsItemDanceRing(item))
|
||||
|
13
src/bmunit.c
13
src/bmunit.c
@ -5,6 +5,7 @@
|
||||
#include "constants/items.h"
|
||||
#include "constants/classes.h"
|
||||
#include "constants/characters.h"
|
||||
#include "constants/terrains.h"
|
||||
|
||||
#include "bmitem.h"
|
||||
#include "bmunit.h"
|
||||
@ -13,7 +14,7 @@
|
||||
#include "bmbattle.h"
|
||||
|
||||
EWRAM_DATA u8 gActiveUnitId = 0;
|
||||
EWRAM_DATA struct { short x, y; } gActiveUnitMoveOrigin = {}; // TODO: struct Vec2?
|
||||
EWRAM_DATA struct Vec2 gActiveUnitMoveOrigin = {};
|
||||
|
||||
EWRAM_DATA struct Unit gUnitArrayBlue[62] = {}; // Player units
|
||||
EWRAM_DATA struct Unit gUnitArrayRed[50] = {}; // Red units
|
||||
@ -357,7 +358,7 @@ inline void AddUnitHp(struct Unit* unit, int amount) {
|
||||
int GetUnitFogViewRange(struct Unit* unit) {
|
||||
int result = gUnknown_0202BCF0.chapterVisionRange;
|
||||
|
||||
if (UNIT_CATTRIBUTES(unit) & CA_LOCKPICK)
|
||||
if (UNIT_CATTRIBUTES(unit) & CA_THIEF)
|
||||
result += 5;
|
||||
|
||||
return result + unit->torchDuration;
|
||||
@ -1226,7 +1227,7 @@ void sub_8018A7C(struct Unit* unit, int x, int y) {
|
||||
int GetUnitKeyItemSlotForTerrain(struct Unit* unit, int terrain) {
|
||||
int slot, item = 0;
|
||||
|
||||
if (UNIT_CATTRIBUTES(unit) & CA_LOCKPICK) {
|
||||
if (UNIT_CATTRIBUTES(unit) & CA_THIEF) {
|
||||
int slot = GetUnitItemSlot(unit, ITEM_LOCKPICK);
|
||||
|
||||
if (slot >= 0)
|
||||
@ -1235,9 +1236,7 @@ int GetUnitKeyItemSlotForTerrain(struct Unit* unit, int terrain) {
|
||||
|
||||
switch (terrain) {
|
||||
|
||||
// TODO: terrain id constants
|
||||
|
||||
case 0x21:
|
||||
case TERRAIN_CHEST_21:
|
||||
slot = GetUnitItemSlot(unit, ITEM_CHESTKEY);
|
||||
|
||||
if (slot < 0)
|
||||
@ -1245,7 +1244,7 @@ int GetUnitKeyItemSlotForTerrain(struct Unit* unit, int terrain) {
|
||||
|
||||
return slot;
|
||||
|
||||
case 0x1E:
|
||||
case TERRAIN_DOOR:
|
||||
item = ITEM_DOORKEY;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user