diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 65d30295a..d4b8aa740 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -2,6 +2,8 @@ #include +// pr comment retry + #define f1585 1.0f #define f1586 0.0f #define f1657 0.2f @@ -376,29 +378,77 @@ U8 zNPCBPlankton::ColChkByFlags() const return 16; } -S32 zNPCGoalBPlanktonBomb::Process(en_trantype*, F32, void*, xScene*) +xFactoryInst* zNPCGoalBPlanktonIdle::create(S32 who, RyzMemGrow* grow, void* info) { - return 0; + return new (who, grow) zNPCGoalBPlanktonIdle(who, (zNPCBPlankton&)*info); } -S32 zNPCGoalBPlanktonMissle::Process(en_trantype*, F32, void*, xScene*) +xFactoryInst* zNPCGoalBPlanktonAttack::create(S32 who, RyzMemGrow* grow, void* info) { - return 0; + return new (who, grow) zNPCGoalBPlanktonAttack(who, (zNPCBPlankton&)*info); } -S32 zNPCGoalBPlanktonWall::Process(en_trantype*, F32, void*, xScene*) +xFactoryInst* zNPCGoalBPlanktonAmbush::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonAmbush(who, (zNPCBPlankton&)*info); +} + +xFactoryInst* zNPCGoalBPlanktonFlank::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonFlank(who, (zNPCBPlankton&)*info); +} + +xFactoryInst* zNPCGoalBPlanktonEvade::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonEvade(who, (zNPCBPlankton&)*info); +} + +xFactoryInst* zNPCGoalBPlanktonHunt::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonHunt(who, (zNPCBPlankton&)*info); +} + +S32 zNPCGoalBPlanktonHunt::Enter(float dt, void* updCtxt) +{ + owner.reappear(); + get_player_loc(); + owner.flag.attacking = true; + owner.delay = 0.0f; + owner.reset_speed(); + owner.refresh_orbit(); + owner.follow_camera(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBPlanktonHunt::Exit(float dt, void* updCtxt) +{ + owner.refresh_orbit(); + return xGoal::Exit(dt, updCtxt); +} + +xFactoryInst* zNPCGoalBPlanktonTaunt::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonTaunt(who, (zNPCBPlankton&)*info); +} + +S32 zNPCGoalBPlanktonTaunt::Process(en_trantype*, F32, void*, xScene*) { return 0; } +xFactoryInst* zNPCGoalBPlanktonMove::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonMove(who, (zNPCBPlankton&)*info); +} + S32 zNPCGoalBPlanktonMove::Process(en_trantype*, F32, void*, xScene*) { return 0; } -xFactoryInst* zNPCGoalBPlanktonBomb::create(S32 who, RyzMemGrow* grow, void* info) +xFactoryInst* zNPCGoalBPlanktonStun::create(S32 who, RyzMemGrow* grow, void* info) { - return 0; // To-Do + return new (who, grow) zNPCGoalBPlanktonStun(who, (zNPCBPlankton&)*info); } S32 zNPCGoalBPlanktonStun::Enter(float dt, void* updCtxt) @@ -416,6 +466,16 @@ S32 zNPCGoalBPlanktonStun::Exit(float dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalBPlanktonFall::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonFall(who, (zNPCBPlankton&)*info); +} + +xFactoryInst* zNPCGoalBPlanktonDizzy::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonDizzy(who, (zNPCBPlankton&)*info); +} + S32 zNPCGoalBPlanktonDizzy::Enter(float dt, void* updCtxt) { owner.give_control(); @@ -424,6 +484,11 @@ S32 zNPCGoalBPlanktonDizzy::Enter(float dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +xFactoryInst* zNPCGoalBPlanktonBeam::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonBeam(who, (zNPCBPlankton&)*info); +} + S32 zNPCGoalBPlanktonBeam::Enter(float dt, void* updCtxt) { xParEmitter parE; @@ -437,27 +502,77 @@ S32 zNPCGoalBPlanktonBeam::Enter(float dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } -S32 zNPCGoalBPlanktonBomb::Enter(float dt, void* updCtxt) +S32 zNPCGoalBPlanktonBeam::Exit(float dt, void* updCtxt) { - return zNPCGoalCommon::Enter(dt, updCtxt); + xParEmitter parE; + xParEmitter& pEmit = parE; // this is one of the codes of all time + owner.flag.aim_gun = false; + owner.flag.follow = owner.FOLLOW_NONE; + owner.disable_emitter(pEmit); + return xGoal::Exit(dt, updCtxt); } -S32 zNPCGoalBPlanktonHunt::Enter(float dt, void* updCtxt) +S32 zNPCGoalBPlanktonBeam::Process(en_trantype* trantype, F32 dt, void* unk, + xScene* xscn) // void* should be someting else. +// cross reference other files for the answer + +// Im probably just dumb, but i dont get how this should be written. { - owner.reappear(); - get_player_loc(); - owner.flag.attacking = true; - owner.delay = 0.0f; - owner.reset_speed(); - owner.refresh_orbit(); - owner.follow_camera(); - return zNPCGoalCommon::Enter(dt, updCtxt); + S32 tempProcess; + tempProcess = emitted; + if (tempProcess != 2) + { + zNPCGoalBPlanktonBeam::update_warm_up(dt); + } + else if (tempProcess < 2) + { + if (tempProcess == 0) + { + zNPCGoalBPlanktonBeam::update_fire(dt); + } + else + { + zNPCGoalBPlanktonBeam::update_cool_down(dt); + } + } + else if (tempProcess < 4) + { + unk = 0; + tempProcess = owner.next_goal(); + return tempProcess; + } + + return 0; } -S32 zNPCGoalBPlanktonHunt::Exit(float dt, void* updCtxt) +xFactoryInst* zNPCGoalBPlanktonWall::create(S32 who, RyzMemGrow* grow, void* info) { - owner.refresh_orbit(); - return xGoal::Exit(dt, updCtxt); + return new (who, grow) zNPCGoalBPlanktonWall(who, (zNPCBPlankton&)*info); +} + +S32 zNPCGoalBPlanktonWall::Process(en_trantype*, F32, void*, xScene*) +{ + return 0; +} + +xFactoryInst* zNPCGoalBPlanktonMissle::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonMissle(who, (zNPCBPlankton&)*info); +} + +S32 zNPCGoalBPlanktonMissle::Process(en_trantype*, F32, void*, xScene*) +{ + return 0; +} + +xFactoryInst* zNPCGoalBPlanktonBomb::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalBPlanktonBomb(who, (zNPCBPlankton&)*info); +} + +S32 zNPCGoalBPlanktonBomb::Enter(float dt, void* updCtxt) +{ + return zNPCGoalCommon::Enter(dt, updCtxt); } S32 zNPCGoalBPlanktonBomb::Exit(float dt, void* updCtxt) @@ -465,7 +580,7 @@ S32 zNPCGoalBPlanktonBomb::Exit(float dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } -S32 zNPCGoalBPlanktonTaunt::Process(en_trantype*, F32, void*, xScene*) +S32 zNPCGoalBPlanktonBomb::Process(en_trantype*, F32, void*, xScene*) { return 0; } diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index be7ec5e9a..61d4aa9d5 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -142,12 +142,17 @@ struct zNPCBPlankton : zNPCBoss // Not yet organized void enable_emitter(xParEmitter&) const; + void disable_emitter(xParEmitter&) const; }; struct zNPCGoalBPlanktonIdle : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonIdle(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -155,6 +160,10 @@ struct zNPCGoalBPlanktonAttack : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonAttack(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -162,6 +171,10 @@ struct zNPCGoalBPlanktonAmbush : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonAmbush(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -170,6 +183,10 @@ struct zNPCGoalBPlanktonFlank : zNPCGoalCommon F32 accel; zNPCBPlankton& owner; + zNPCGoalBPlanktonFlank(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -178,6 +195,10 @@ struct zNPCGoalBPlanktonEvade : zNPCGoalCommon F32 evade_delay; zNPCBPlankton& owner; + zNPCGoalBPlanktonEvade(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -186,6 +207,10 @@ struct zNPCGoalBPlanktonHunt : zNPCGoalCommon xVec3 player_loc; zNPCBPlankton& owner; + zNPCGoalBPlanktonHunt(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Enter(float, void*); @@ -196,6 +221,10 @@ struct zNPCGoalBPlanktonTaunt : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonTaunt(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Process(en_trantype*, float, void*, xScene*); }; @@ -204,6 +233,10 @@ struct zNPCGoalBPlanktonMove : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonMove(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Process(en_trantype*, float, void*, xScene*); }; @@ -212,6 +245,10 @@ struct zNPCGoalBPlanktonStun : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonStun(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Enter(float, void*); S32 Exit(float, void*); @@ -222,6 +259,10 @@ struct zNPCGoalBPlanktonFall : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonFall(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -229,6 +270,10 @@ struct zNPCGoalBPlanktonDizzy : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonDizzy(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Enter(float, void*); S32 Exit(float, void*); @@ -248,14 +293,27 @@ struct zNPCGoalBPlanktonBeam : zNPCGoalCommon substate_enum substate; zNPCBPlankton& owner; + zNPCGoalBPlanktonBeam(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Enter(float, void*); + S32 Exit(float, void*); + S32 Process(en_trantype*, float, void*, xScene*); + S32 update_cool_down(float); + S32 update_warm_up(float); + S32 update_fire(float); }; struct zNPCGoalBPlanktonWall : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonWall(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Process(en_trantype*, float, void*, xScene*); }; @@ -264,6 +322,10 @@ struct zNPCGoalBPlanktonMissle : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonMissle(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Process(en_trantype*, float, void*, xScene*); }; @@ -272,6 +334,10 @@ struct zNPCGoalBPlanktonBomb : zNPCGoalCommon { zNPCBPlankton& owner; + zNPCGoalBPlanktonBomb(S32 goalID, zNPCBPlankton& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Enter(float, void*); S32 Exit(float, void*); diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 36b5563c0..4aa5d3e23 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -388,20 +388,7 @@ S32 zNPCGoalDutchmanIdle::Process(en_trantype* trantype, float dt, void* updCtxt xFactoryInst* zNPCGoalDutchmanDisappear::create(S32 who, RyzMemGrow* grow, void* info) { - zNPCGoalDutchmanDisappear* tempVar; - tempVar = new (who, grow) zNPCGoalDutchmanDisappear(who, (zNPCDutchman&)*info); - // tempVar = new (who, grow) RyzMemGrow(grow); - if (tempVar != NULL) - { - //tempVar = zNPCGoalDutchmanDisappear(0, (zNPCDutchman&)*info); - // tempVar = new (who, grow) zNPCGoalDutchmanDisappear(who, (zNPCDutchman&)*info); - - //goal = new (who, growCtxt) xGoalEmpty(who); - } - // if () - // { - // } - return 0; + return new (who, grow) zNPCGoalDutchmanDisappear(who, (zNPCDutchman&)*info); } S32 zNPCGoalDutchmanDisappear::Exit(F32 dt, void* updCtxt)