mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-14 10:37:17 -07:00
Implement GameInteractor & move CrowdControl and console commands to it (#2358)
* Begin GameInteractor * Basic skeleton of PoC * WIP * First 2 CC effects transitioned to GameInteractor * Prepare GameInteractor classes for CrowdControl * More effects & replace chaosEffects with GameInteractor * CC connection fixes & all CC effects (enemy spawns still borked) * First couple of build error fixes * Fix build * Proper enemy spawning * Clean up old CC code * Extract link size/invisibility into GameInteractor * Small fix/cleanup * Suggestions for PR * Address PR comment * Addressed more comments & small adjustments * Fix crash when spawning enemies * Remove Remove() * Move checks into Apply() and move CC and some console commands to it * Use inheritance to abstract check on application * Rename prefix Actions with RawAction * Make Remove return a Result * Fix issue with compilation * debugconsole -> GameInteractionEffects progress * Add State in GI * Unify some Effects * Port more debug console items * Remove state modifyiers from raw actions * Port over last raw action / state in console * Adjust some types * Consolidate link size modifier effect * Adjust more types * Define category strings in CC * Clean up remaining non defined strings * Fix bug in timed effects * Rename old pack * CC fixes * Translate GI enum function * Console cleanup/fixes/consistency Co-authored-by: David Chavez <david@dcvz.io>
This commit is contained in:
parent
ec4cee787c
commit
170a9103f9
17 changed files with 1686 additions and 598 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
#include "soh/Enhancements/debugconsole.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
||||
//#include <string.h>
|
||||
|
||||
|
@ -229,11 +229,11 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
|
|||
case 0:
|
||||
input->cur = *padnow1;
|
||||
|
||||
if (chaosEffectNoZ) {
|
||||
if (GameInteractor_DisableZTargetingActive()) {
|
||||
input->cur.button &= ~(BTN_Z);
|
||||
}
|
||||
|
||||
if (chaosEffectReverseControls) {
|
||||
if (GameInteractor_ReverseControlsActive()) {
|
||||
if (input->cur.stick_x == -128) {
|
||||
input->cur.stick_x = 127;
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#include "soh/Enhancements/debugconsole.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
||||
|
||||
static uint16_t _doActionTexWidth, _doActionTexHeight = -1;
|
||||
|
@ -939,7 +939,7 @@ void func_80083108(PlayState* play) {
|
|||
Interface_ChangeAlpha(50);
|
||||
}
|
||||
} else if (msgCtx->msgMode == MSGMODE_NONE) {
|
||||
if (chaosEffectPacifistMode) {
|
||||
if (GameInteractor_PacifistModeActive()) {
|
||||
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
|
||||
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] =
|
||||
gSaveContext.buttonStatus[7] = gSaveContext.buttonStatus[8] = BTN_DISABLED;
|
||||
|
@ -3074,7 +3074,7 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
|
|||
}
|
||||
|
||||
// If one-hit ko mode is on, any damage kills you and you cannot gain health.
|
||||
if (chaosEffectOneHitKO) {
|
||||
if (GameInteractor_OneHitKOActive()) {
|
||||
if (healthChange < 0) {
|
||||
gSaveContext.health = 0;
|
||||
}
|
||||
|
@ -3091,11 +3091,12 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
|
|||
}
|
||||
// clang-format on
|
||||
|
||||
if (chaosEffectDefenseModifier != 0 && healthChange < 0) {
|
||||
if (chaosEffectDefenseModifier > 0) {
|
||||
healthChange /= chaosEffectDefenseModifier;
|
||||
int32_t giDefenseModifier = GameInteractor_DefenseModifier();
|
||||
if (giDefenseModifier != 0 && healthChange < 0) {
|
||||
if (giDefenseModifier > 0) {
|
||||
healthChange /= giDefenseModifier;
|
||||
} else {
|
||||
healthChange *= abs(chaosEffectDefenseModifier);
|
||||
healthChange *= abs(giDefenseModifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3129,14 +3130,6 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
|
|||
}
|
||||
}
|
||||
|
||||
void Health_GiveHearts(s16 hearts) {
|
||||
gSaveContext.healthCapacity += hearts * 0x10;
|
||||
}
|
||||
|
||||
void Health_RemoveHearts(s16 hearts) {
|
||||
gSaveContext.healthCapacity -= hearts * 0x10;
|
||||
}
|
||||
|
||||
void Rupees_ChangeBy(s16 rupeeChange) {
|
||||
gSaveContext.rupeeAccumulator += rupeeChange;
|
||||
|
||||
|
@ -4968,7 +4961,7 @@ void Interface_Draw(PlayState* play) {
|
|||
s16 svar6;
|
||||
bool fullUi = !CVarGetInteger("gMinimalUI", 0) || !R_MINIMAP_DISABLED || play->pauseCtx.state != 0;
|
||||
|
||||
if (chaosEffectNoUI) {
|
||||
if (GameInteractor_NoUIActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "objects/object_triforce_spot/object_triforce_spot.h"
|
||||
#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h"
|
||||
|
||||
#include "soh/Enhancements/debugconsole.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 flag;
|
||||
|
@ -1050,7 +1050,7 @@ s32 func_80090014(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
|
|||
}
|
||||
}
|
||||
|
||||
if (chaosEffectInvisibleLink) {
|
||||
if (GameInteractor_InvisibleLinkActive()) {
|
||||
this->actor.shape.shadowDraw = NULL;
|
||||
*dList = NULL;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "textures/icon_item_24_static/icon_item_24_static.h"
|
||||
#include <soh/Enhancements/custom-message/CustomMessageTypes.h>
|
||||
#include "soh/Enhancements/item-tables/ItemTableTypes.h"
|
||||
#include "soh/Enhancements/debugconsole.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -6080,11 +6080,12 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
|
|||
if (this->swordState == 0) {
|
||||
float maxSpeed = R_RUN_SPEED_LIMIT / 100.0f;
|
||||
|
||||
if (chaosEffectSpeedModifier != 0) {
|
||||
if (chaosEffectSpeedModifier > 0) {
|
||||
maxSpeed *= chaosEffectSpeedModifier;
|
||||
int32_t giSpeedModifier = GameInteractor_RunSpeedModifier();
|
||||
if (giSpeedModifier != 0) {
|
||||
if (giSpeedModifier > 0) {
|
||||
maxSpeed *= giSpeedModifier;
|
||||
} else {
|
||||
maxSpeed /= abs(chaosEffectSpeedModifier);
|
||||
maxSpeed /= abs(giSpeedModifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7717,11 +7718,12 @@ void func_80842180(Player* this, PlayState* play) {
|
|||
func_80837268(this, &sp2C, &sp2A, 0.018f, play);
|
||||
|
||||
if (!func_8083C484(this, &sp2C, &sp2A)) {
|
||||
if (chaosEffectSpeedModifier != 0) {
|
||||
if (chaosEffectSpeedModifier > 0) {
|
||||
sp2C *= chaosEffectSpeedModifier;
|
||||
int32_t giSpeedModifier = GameInteractor_RunSpeedModifier();
|
||||
if (giSpeedModifier != 0) {
|
||||
if (giSpeedModifier > 0) {
|
||||
sp2C *= giSpeedModifier;
|
||||
} else {
|
||||
sp2C /= abs(chaosEffectSpeedModifier);
|
||||
sp2C /= abs(giSpeedModifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10993,37 +10995,39 @@ void Player_Update(Actor* thisx, PlayState* play) {
|
|||
MREG(54) = this->actor.world.pos.z;
|
||||
MREG(55) = this->actor.world.rot.y;
|
||||
|
||||
if (chaosEffectGiantLink) {
|
||||
this->actor.scale.x = 0.02f;
|
||||
this->actor.scale.y = 0.02f;
|
||||
this->actor.scale.z = 0.02f;
|
||||
switch (GameInteractor_LinkSize()) {
|
||||
case GI_LINK_SIZE_GIANT:
|
||||
this->actor.scale.x = 0.02f;
|
||||
this->actor.scale.y = 0.02f;
|
||||
this->actor.scale.z = 0.02f;
|
||||
break;
|
||||
case GI_LINK_SIZE_MINISH:
|
||||
this->actor.scale.x = 0.001f;
|
||||
this->actor.scale.y = 0.001f;
|
||||
this->actor.scale.z = 0.001f;
|
||||
break;
|
||||
case GI_LINK_SIZE_PAPER:
|
||||
this->actor.scale.x = 0.001f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
this->actor.scale.z = 0.01f;
|
||||
break;
|
||||
case GI_LINK_SIZE_NORMAL:
|
||||
default:
|
||||
this->actor.scale.x = 0.01f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
this->actor.scale.z = 0.01f;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chaosEffectMinishLink) {
|
||||
this->actor.scale.x = 0.001f;
|
||||
this->actor.scale.y = 0.001f;
|
||||
this->actor.scale.z = 0.001f;
|
||||
}
|
||||
|
||||
if (chaosEffectPaperLink) {
|
||||
this->actor.scale.x = 0.001f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
this->actor.scale.z = 0.01f;
|
||||
}
|
||||
|
||||
if (chaosEffectResetLinkScale) {
|
||||
this->actor.scale.x = 0.01f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
this->actor.scale.z = 0.01f;
|
||||
chaosEffectResetLinkScale = 0;
|
||||
}
|
||||
|
||||
if (chaosEffectGravityLevel == GRAVITY_LEVEL_HEAVY) {
|
||||
this->actor.gravity = -4.0f;
|
||||
}
|
||||
|
||||
if (chaosEffectGravityLevel == GRAVITY_LEVEL_LIGHT) {
|
||||
this->actor.gravity = -0.3f;
|
||||
switch (GameInteractor_GravityLevel()) {
|
||||
case GI_GRAVITY_LEVEL_HEAVY:
|
||||
this->actor.gravity = -4.0f;
|
||||
break;
|
||||
case GI_GRAVITY_LEVEL_LIGHT:
|
||||
this->actor.gravity = -0.3f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue