Skip to content

Commit

Permalink
Add 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaneAvernathy committed Mar 31, 2024
1 parent cd95d0f commit ec3e618
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/*.sav
/*.srm

/ideas.txt

/TOOLS/CLib
/TOOLS/EventAssembler
/TOOLS/64tass*
Expand Down
129 changes: 129 additions & 0 deletions FE8/2024/2024.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

#include "gbafe.h"

// Make nonplayer unit ranges unviewable

enum
{
PLAYER_SELECT_NOUNIT = 0,
PLAYER_SELECT_TURNENDED = 1,
PLAYER_SELECT_CONTROL = 2,
PLAYER_SELECT_NOCONTROL = 3,
PLAYER_SELECT_4 = 4,
};

enum BmSt_gameStateBits
{
BM_FLAG_0 = (1 << 0),
BM_FLAG_1 = (1 << 1),
BM_FLAG_2 = (1 << 2),
BM_FLAG_3 = (1 << 3),
BM_FLAG_4 = (1 << 4),
BM_FLAG_5 = (1 << 5), /* Maybe mute battle-anim BGM ? */
BM_FLAG_LINKARENA = (1 << 6),
};

bool CanCharacterBePrepMoved(int unitId);
u8 IsDifficultMode(void);

int GetUnitSelectionValueThing(struct Unit * unit)
{
/*
* FE8U calls this `GetPlayerSelectKind`.
*
* This returns what type of unit was just selected.
* We're going to edit this to make it so that you can't select
* units that aren't part of your faction on hard mode.
*/

u8 faction = gChapterData.currentPhase;

if (!unit)
{
return PLAYER_SELECT_NOUNIT;
}

if (gGameState.statebits & BM_FLAG_4)
{
if (!CanCharacterBePrepMoved(unit->pCharacterData->number))
{
return PLAYER_SELECT_4;
}

faction = FACTION_BLUE;
}

if (!unit)
{
return PLAYER_SELECT_NOUNIT;
}

if (UNIT_FACTION(unit) != faction)
{

if ( IsDifficultMode() )
return PLAYER_SELECT_NOUNIT;

return PLAYER_SELECT_NOCONTROL;
}

if (unit->state & US_UNSELECTABLE)
{
return PLAYER_SELECT_TURNENDED;
}

if (UNIT_CATTRIBUTES(unit) & CA_UNSELECTABLE)
{
return PLAYER_SELECT_TURNENDED;
}

if ((unit->statusIndex != UNIT_STATUS_SLEEP) && (unit->statusIndex != UNIT_STATUS_BERSERK))
{
return PLAYER_SELECT_CONTROL;
}

return PLAYER_SELECT_NOCONTROL;
}

// Remove the weapon triangle on hard mode

struct WeaponTriangleRule {
s8 attackerWeaponType;
s8 defenderWeaponType;
s8 hitBonus;
s8 atkBonus;
};

extern struct WeaponTriangleRule sWeaponTriangleRules[];
void BattleApplyReaverEffect(struct BattleUnit* attacker, struct BattleUnit* defender);

void BattleApplyWeaponTriangleEffect(struct BattleUnit* attacker, struct BattleUnit* defender)
{
/*
* This checks for weapon triangle effects and adjusts hit rates.
* We're going to make it so that the triangle doesn't apply on hard mode.
*/

if ( IsDifficultMode() )
return;

const struct WeaponTriangleRule* it;

for (it = sWeaponTriangleRules; it->attackerWeaponType >= 0; ++it) {
if ((attacker->weaponType == it->attackerWeaponType) && (defender->weaponType == it->defenderWeaponType)) {
attacker->wTriangleHitBonus = it->hitBonus;
attacker->wTriangleDmgBonus = it->atkBonus;

defender->wTriangleHitBonus = -it->hitBonus;
defender->wTriangleDmgBonus = -it->atkBonus;

break;
}
}

if (attacker->weaponAttributes & IA_REVERTTRIANGLE)
BattleApplyReaverEffect(attacker, defender);

if (defender->weaponAttributes & IA_REVERTTRIANGLE)
BattleApplyReaverEffect(attacker, defender);
}
9 changes: 9 additions & 0 deletions FE8/2024/2024.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#ifdef USE_2024
#ifndef HARD_MODE_GUARD
#define HARD_MODE_GUARD

#include "2024.lyn.event"

#endif // HARD_MODE_GUARD
#endif // USE_2024
1 change: 1 addition & 0 deletions FE8/Buildfile.event
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ ORG Freespace; {
#include "Extensions/Hack Installation.txt"

#include "2023/2023.event"
#include "2024/2024.event"

}
1 change: 1 addition & 0 deletions FE8/CommonDefinitions.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ SET_FUNC DrawDifficultyDescription, 0x80ABFE1
SET_FUNC Text_DrawChar_, 0x08004181

SET_DATA DifficultyDescriptions, 0x08A20A08
SET_DATA sWeaponTriangleRules, 0x0859BA90
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif
# Game-specific dependencies are handled in their individual makefiles.

export FE5_YEARS = 2019 2022
export FE8_YEARS = 2023
export FE8_YEARS = 2023 2024
.PHONY: $(FE5_YEARS) $(FE8_YEARS)

export NOTIFY_PROCESS = @echo "$(notdir $<) => $(notdir $@)"
Expand Down
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,22 @@ In the root folder:

## Credits

[stan](https://github.com/StanHash) - CLib, lyn, ea-dep, makefiles, CHAX, wizardry, being incredible, the list goes on.
[CrazyColorz5](https://github.com/CrazyColorz5) - ParseFile, Event Assembler, ColorzCore, the buildfile method.
[soci](https://sourceforge.net/projects/tass64/) - 64tass
* [stan](https://github.com/StanHash) - CLib, lyn, ea-dep, makefiles, CHAX, wizardry, being incredible, the list goes on.
* [CrazyColorz5](https://github.com/CrazyColorz5) - ParseFile, Event Assembler, ColorzCore, the buildfile method.
* [soci](https://sourceforge.net/projects/tass64/) - 64tass

Misc. shout outs:
circleseverywhere
Hextator
Nintenlord
Leonarth
Camdar
Contro
Snek
Sme
Huichelaar
Teraspark
Devvy
Tequila
Two Who Belong
* circleseverywhere
* Hextator
* Nintenlord
* Leonarth
* Camdar
* Contro
* Snek
* Sme
* Huichelaar
* Teraspark
* Devvy
* Tequila
* Two Who Belong
* Vesly

0 comments on commit ec3e618

Please sign in to comment.