mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
Fix some dark link issues (#5532)
This commit is contained in:
parent
fc10e36cdb
commit
40da9997c5
5 changed files with 97 additions and 8 deletions
|
@ -11,8 +11,13 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
|
#include "src/overlays/actors/ovl_En_Rr/z_en_rr.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)
|
||||||
|
|
||||||
const char* enemyCVarList[] = {
|
const char* enemyCVarList[] = {
|
||||||
CVAR_ENHANCEMENT("RandomizedEnemyList.Armos"), CVAR_ENHANCEMENT("RandomizedEnemyList.Arwing"),
|
CVAR_ENHANCEMENT("RandomizedEnemyList.Armos"), CVAR_ENHANCEMENT("RandomizedEnemyList.Arwing"),
|
||||||
CVAR_ENHANCEMENT("RandomizedEnemyList.BabyDodongo"), CVAR_ENHANCEMENT("RandomizedEnemyList.Bari"),
|
CVAR_ENHANCEMENT("RandomizedEnemyList.BabyDodongo"), CVAR_ENHANCEMENT("RandomizedEnemyList.Bari"),
|
||||||
|
@ -339,7 +344,7 @@ EnemyEntry GetRandomizedEnemyEntry(uint32_t seed, PlayState* play) {
|
||||||
if (filteredEnemyList.size() == 0) {
|
if (filteredEnemyList.size() == 0) {
|
||||||
filteredEnemyList = selectedEnemyList;
|
filteredEnemyList = selectedEnemyList;
|
||||||
}
|
}
|
||||||
if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) {
|
if (CVAR_ENEMY_RANDOMIZER_VALUE == ENEMY_RANDOMIZER_RANDOM_SEEDED) {
|
||||||
uint32_t finalSeed =
|
uint32_t finalSeed =
|
||||||
seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt);
|
seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt);
|
||||||
Random_Init(finalSeed);
|
Random_Init(finalSeed);
|
||||||
|
@ -533,3 +538,45 @@ bool IsEnemyAllowedToSpawn(int16_t sceneNum, int8_t roomNum, EnemyEntry enemy) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegisterEnemyRandomizer() {
|
||||||
|
// prevent dark link from triggering a voidout
|
||||||
|
COND_VB_SHOULD(VB_TRIGGER_VOIDOUT, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, {
|
||||||
|
Actor* actor = va_arg(args, Actor*);
|
||||||
|
|
||||||
|
if (actor->category != ACTORCAT_PLAYER) {
|
||||||
|
*should = false;
|
||||||
|
Actor_Kill(actor);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// prevent dark link dealing fall damage to the player
|
||||||
|
COND_VB_SHOULD(VB_RECIEVE_FALL_DAMAGE, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, {
|
||||||
|
Actor* actor = va_arg(args, Actor*);
|
||||||
|
|
||||||
|
if (actor->category != ACTORCAT_PLAYER) {
|
||||||
|
*should = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// prevent dark link from interfering with HESS/recoil/etc when at more than 100 away from him
|
||||||
|
COND_VB_SHOULD(VB_TORCH2_HANDLE_CLANKING, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, {
|
||||||
|
Actor* darkLink = va_arg(args, Actor*);
|
||||||
|
|
||||||
|
if (darkLink->xzDistToPlayer > 100.0f) {
|
||||||
|
*should = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// prevent dark link from being grabbed by like likes and therefore grabbing the player
|
||||||
|
COND_VB_SHOULD(VB_LIKE_LIKE_GRAB_PLAYER, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, {
|
||||||
|
EnRr* likeLike = va_arg(args, EnRr*);
|
||||||
|
|
||||||
|
if (!(likeLike->collider1.base.oc != NULL && likeLike->collider1.base.oc->category == ACTORCAT_PLAYER) &&
|
||||||
|
!(likeLike->collider2.base.oc != NULL && likeLike->collider2.base.oc->category == ACTORCAT_PLAYER)) {
|
||||||
|
*should = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static RegisterShipInitFunc initFunc(RegisterEnemyRandomizer, { CVAR_ENEMY_RANDOMIZER_NAME });
|
|
@ -2011,6 +2011,38 @@ typedef enum {
|
||||||
// #### `args`
|
// #### `args`
|
||||||
// - `*EnWonderTalk2`
|
// - `*EnWonderTalk2`
|
||||||
VB_WONDER_TALK,
|
VB_WONDER_TALK,
|
||||||
|
|
||||||
|
// #### `result`
|
||||||
|
// ```c
|
||||||
|
// true
|
||||||
|
// ```
|
||||||
|
// #### `args`
|
||||||
|
// - `*Actor`
|
||||||
|
VB_TRIGGER_VOIDOUT,
|
||||||
|
|
||||||
|
// #### `result`
|
||||||
|
// ```c
|
||||||
|
// true
|
||||||
|
// ```
|
||||||
|
// #### `args`
|
||||||
|
// - `*Actor`
|
||||||
|
VB_TORCH2_HANDLE_CLANKING,
|
||||||
|
|
||||||
|
// #### `result`
|
||||||
|
// ```c
|
||||||
|
// true
|
||||||
|
// ```
|
||||||
|
// #### `args`
|
||||||
|
// - `*Actor`
|
||||||
|
VB_RECIEVE_FALL_DAMAGE,
|
||||||
|
|
||||||
|
// #### `result`
|
||||||
|
// ```c
|
||||||
|
// true
|
||||||
|
// ```
|
||||||
|
// #### `args`
|
||||||
|
// - `*EnRr`
|
||||||
|
VB_LIKE_LIKE_GRAB_PLAYER,
|
||||||
} GIVanillaBehavior;
|
} GIVanillaBehavior;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -507,7 +507,7 @@ void EnRr_CollisionCheck(EnRr* this, PlayState* play) {
|
||||||
this->collider2.base.ocFlags1 &= ~OC1_HIT;
|
this->collider2.base.ocFlags1 &= ~OC1_HIT;
|
||||||
// "catch"
|
// "catch"
|
||||||
osSyncPrintf(VT_FGCOL(GREEN) "キャッチ(%d)!!" VT_RST "\n", this->frameCount);
|
osSyncPrintf(VT_FGCOL(GREEN) "キャッチ(%d)!!" VT_RST "\n", this->frameCount);
|
||||||
if (play->grabPlayer(play, player)) {
|
if (GameInteractor_Should(VB_LIKE_LIKE_GRAB_PLAYER, true, this) && play->grabPlayer(play, player)) {
|
||||||
player->actor.parent = &this->actor;
|
player->actor.parent = &this->actor;
|
||||||
this->stopScroll = false;
|
this->stopScroll = false;
|
||||||
EnRr_SetupGrabPlayer(this, player);
|
EnRr_SetupGrabPlayer(this, player);
|
||||||
|
|
|
@ -706,7 +706,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) {
|
||||||
sStaggerCount = 0;
|
sStaggerCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player->linearVelocity == -18.0f) {
|
if (GameInteractor_Should(VB_TORCH2_HANDLE_CLANKING, player->linearVelocity == -18.0f, this)) {
|
||||||
if (this->actor.xzDistToPlayer > 80.0f) {
|
if (this->actor.xzDistToPlayer > 80.0f) {
|
||||||
player->linearVelocity = 1.2f;
|
player->linearVelocity = 1.2f;
|
||||||
} else if (this->actor.xzDistToPlayer < 70.0f) {
|
} else if (this->actor.xzDistToPlayer < 70.0f) {
|
||||||
|
|
|
@ -4764,7 +4764,9 @@ s32 func_808382DC(Player* this, PlayState* play) {
|
||||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw = respawnInfo->yaw;
|
gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw = respawnInfo->yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
Play_TriggerVoidOut(play);
|
if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
|
||||||
|
Play_TriggerVoidOut(play);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player_PlayVoiceSfx(this, NA_SE_VO_LI_TAKEN_AWAY);
|
Player_PlayVoiceSfx(this, NA_SE_VO_LI_TAKEN_AWAY);
|
||||||
|
@ -5129,7 +5131,9 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exitIndex == 0) {
|
if (exitIndex == 0) {
|
||||||
Play_TriggerVoidOut(play);
|
if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
|
||||||
|
Play_TriggerVoidOut(play);
|
||||||
|
}
|
||||||
Scene_SetTransitionForNextEntrance(play);
|
Scene_SetTransitionForNextEntrance(play);
|
||||||
} else {
|
} else {
|
||||||
play->nextEntranceIndex = play->setupExitList[exitIndex - 1];
|
play->nextEntranceIndex = play->setupExitList[exitIndex - 1];
|
||||||
|
@ -5163,7 +5167,9 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
|
||||||
SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2,
|
SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2,
|
||||||
play->setupExitList[exitIndex - 1])) {
|
play->setupExitList[exitIndex - 1])) {
|
||||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex;
|
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex;
|
||||||
Play_TriggerVoidOut(play);
|
if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
|
||||||
|
Play_TriggerVoidOut(play);
|
||||||
|
}
|
||||||
gSaveContext.respawnFlag = -2;
|
gSaveContext.respawnFlag = -2;
|
||||||
}
|
}
|
||||||
gSaveContext.retainWeatherMode = 1;
|
gSaveContext.retainWeatherMode = 1;
|
||||||
|
@ -5226,7 +5232,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
|
||||||
if (this->actor.bgCheckFlags & 1) {
|
if (this->actor.bgCheckFlags & 1) {
|
||||||
if (this->floorProperty == 5) {
|
if (this->floorProperty == 5) {
|
||||||
Play_TriggerRespawn(play);
|
Play_TriggerRespawn(play);
|
||||||
} else {
|
} else if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
|
||||||
Play_TriggerVoidOut(play);
|
Play_TriggerVoidOut(play);
|
||||||
}
|
}
|
||||||
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
|
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
|
||||||
|
@ -9613,6 +9619,10 @@ static FallImpactInfo D_80854600[] = {
|
||||||
s32 func_80843E64(PlayState* play, Player* this) {
|
s32 func_80843E64(PlayState* play, Player* this) {
|
||||||
s32 sp34;
|
s32 sp34;
|
||||||
|
|
||||||
|
if (!GameInteractor_Should(VB_RECIEVE_FALL_DAMAGE, true, this)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((sFloorType == 6) || (sFloorType == 9)) {
|
if ((sFloorType == 6) || (sFloorType == 9)) {
|
||||||
sp34 = 0;
|
sp34 = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -15009,7 +15019,7 @@ void Player_Action_8084F88C(Player* this, PlayState* play) {
|
||||||
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) {
|
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) {
|
||||||
Grotto_ForceRegularVoidOut();
|
Grotto_ForceRegularVoidOut();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
|
||||||
Play_TriggerVoidOut(play);
|
Play_TriggerVoidOut(play);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue