mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Use hook
This commit is contained in:
parent
15a611564e
commit
f3b0d0780d
2 changed files with 17 additions and 4 deletions
|
@ -13,6 +13,10 @@ extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CVAR_ENEMY_RANDOMIZER_NAME CVAR_ENHANCEMENT("RandomizedEnemies")
|
||||||
|
#define CVAR_ENEMY_RANDOMIZER_DEFAULT ENEMY_RANDOMIZER_OFF
|
||||||
|
#define CVAR_ENEMY_RANDOMIZER_VALUE CVarGetInteger(CVAR_ENEMY_RANDOMIZER_NAME, CVAR_ENEMY_RANDOMIZER_DEFAULT)
|
||||||
|
|
||||||
typedef struct EnemyEntry {
|
typedef struct EnemyEntry {
|
||||||
int16_t id;
|
int16_t id;
|
||||||
int16_t params;
|
int16_t params;
|
||||||
|
@ -558,3 +562,16 @@ bool IsEnemyAllowedToSpawn(int16_t sceneNum, int8_t roomNum, EnemyEntry enemy) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixClubMoblinScale(void* ptr) {
|
||||||
|
Actor* actor = (Actor*)ptr;
|
||||||
|
if (actor->params == -1) {
|
||||||
|
Actor_SetScale(actor, 0.014f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterEnemyRandomizer() {
|
||||||
|
COND_ID_HOOK(OnActorInit, ACTOR_EN_MB, CVAR_ENEMY_RANDOMIZER_VALUE, FixClubMoblinScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
static RegisterShipInitFunc initFunc(RegisterEnemyRandomizer, { CVAR_ENEMY_RANDOMIZER_NAME });
|
|
@ -281,10 +281,6 @@ void EnMb_Init(Actor* thisx, PlayState* play) {
|
||||||
SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable,
|
SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable,
|
||||||
this->morphTable, 28);
|
this->morphTable, 28);
|
||||||
|
|
||||||
if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), ENEMY_RANDOMIZER_OFF) != ENEMY_RANDOMIZER_OFF) {
|
|
||||||
Actor_SetScale(&this->actor, 0.014f);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->actor.colChkInfo.health = 2;
|
this->actor.colChkInfo.health = 2;
|
||||||
this->actor.colChkInfo.mass = MASS_HEAVY;
|
this->actor.colChkInfo.mass = MASS_HEAVY;
|
||||||
this->maxHomeDist = 1000.0f;
|
this->maxHomeDist = 1000.0f;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue