diff --git a/makefile.gaz b/makefile.gaz index 8eae2fc4e..c6f189187 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -41,7 +41,7 @@ PC_STARTUP_OBJ := PC_FILESYS_LIB := libsn CD_FILESYS_SRC := cdfile -CD_STARTUP_OBJ := BootObj\snmain +CD_STARTUP_OBJ := BootObj\snmain CD_FILESYS_LIB := CMXBoot #---------------------------------------------------------------------------- @@ -64,6 +64,8 @@ enemy_src := 2denemy \ neyeball \ nsstomp \ nbooger \ + nmjfish \ + nfdutch \ enemy projectl_src := projectl @@ -115,7 +117,7 @@ level_src := level \ layerback \ layertilesolid \ layertile3d - + locale_src := textdbase mem_src := memory @@ -356,7 +358,7 @@ ifeq ($(USER_NAME),CDBUILD) @ccpsx -O2 -g $(BOOTSTRAP_IN) -c -Xo$801c0000 $(COMMON_CCFLAGS) -oPsxBoot.o @slink -m -psx -c -v -z -o 0x801c0000 -cpemunge -we -wm -wo @$(BOOTSTRAP_DIR)/psxboot.ln,$(BOOTSTRAP_CPE),$(BOOTSTRAP_SYM),$(BOOTSTRAP_MAP) @$(RM) PsxBoot.o - Cpe2Exe $($(TERRITORY)_CPE2X_PARAM) $(BOOTSTRAP_CPE) + Cpe2Exe $($(TERRITORY)_CPE2X_PARAM) $(BOOTSTRAP_CPE) @$(CP) $(BOOTSTRAP_EXE) $($(TERRITORY)_BOOTSTRAP_OUT) -f @$(CP) Data/$(TERRITORY).cnf $(CD_DIR)/SYSTEM.CNF -f @$(ECHO) $(TERRITORY) CD Built diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index 147cd088d..1a279fe96 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -24,6 +24,65 @@ #endif +void CNpc::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ) +{ + s16 decDir, incDir, moveDist; + s32 moveX, moveY; + s16 headingToTarget = ratan2( yDist, xDist ); + s16 maxTurnRate = m_data[m_type].turnSpeed; + + decDir = m_heading - headingToTarget; + if ( decDir < 0 ) + { + decDir += ONE; + } + + incDir = headingToTarget - m_heading; + if ( incDir < 0 ) + { + incDir += ONE; + } + + if ( decDir < incDir ) + { + moveDist = -decDir; + } + else + { + moveDist = incDir; + } + + if ( moveDist < -maxTurnRate ) + { + moveDist = -maxTurnRate; + } + else if ( moveDist > maxTurnRate ) + { + moveDist = maxTurnRate; + } + + m_heading += moveDist; + m_heading = m_heading % ONE; + + s32 preShiftX = _frames * speed * rcos( m_heading ); + s32 preShiftY = _frames * speed * rsin( m_heading ); + + moveX = preShiftX >> 12; + if ( !moveX && preShiftX ) + { + moveX = preShiftX / abs( preShiftX ); + } + + moveY = preShiftY >> 12; + if ( !moveY && preShiftY ) + { + moveY = preShiftY / abs( preShiftY ); + } + + Pos.vx += moveX; + Pos.vy += moveY; +} + void CNpc::processCloseGenericUserSeek( int _frames ) { s32 moveX = 0, moveY = 0; @@ -51,64 +110,6 @@ void CNpc::processCloseGenericUserSeek( int _frames ) //} //else { - bool pathComplete; - - s16 headingToPlayer = ratan2( yDist, xDist ); - s16 maxTurnRate = m_data[m_type].turnSpeed; - s16 decDir, incDir; - - decDir = m_heading - headingToPlayer; - - if ( decDir < 0 ) - { - decDir += ONE; - } - - incDir = headingToPlayer - m_heading; - - if ( incDir < 0 ) - { - incDir += ONE; - } - - if ( decDir < incDir ) - { - moveDist = -decDir; - } - else - { - moveDist = incDir; - } - - if ( moveDist < -maxTurnRate ) - { - moveDist = -maxTurnRate; - } - else if ( moveDist > maxTurnRate ) - { - moveDist = maxTurnRate; - } - - m_heading += moveDist; - - m_heading = m_heading % ONE; - - s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading ); - s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading ); - - moveX = preShiftX >> 12; - if ( !moveX && preShiftX ) - { - moveX = preShiftX / abs( preShiftX ); - } - - moveY = preShiftY >> 12; - if ( !moveY && preShiftY ) - { - moveY = preShiftY / abs( preShiftY ); - } - - Pos.vx += moveX; - Pos.vy += moveY; + processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); } } diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index e84d94a6f..80a642a70 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -382,12 +382,36 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = 3, 2048, }, + + { // NPC_MOTHER_JELLYFISH + NPC_INIT_MOTHER_JELLYFISH, + NPC_SENSOR_NONE, + NPC_MOVEMENT_MOTHER_JELLYFISH, + NPC_MOVEMENT_MODIFIER_NONE, + NPC_CLOSE_MOTHER_JELLYFISH_ATTACK, + NPC_TIMER_NONE, + false, + 3, + 256, + }, + + { // NPC_FLYING_DUTCHMAN + NPC_INIT_FLYING_DUTCHMAN, + NPC_SENSOR_NONE, + NPC_MOVEMENT_FLYING_DUTCHMAN, + NPC_MOVEMENT_MODIFIER_NONE, + NPC_CLOSE_FLYING_DUTCHMAN_ATTACK, + NPC_TIMER_NONE, + false, + 3, + 256, + }, }; void CNpc::init() { - m_type = NPC_BOOGER_MONSTER; + m_type = NPC_FLYING_DUTCHMAN; m_heading = m_fireHeading = 0; m_movementTimer = 0; @@ -398,6 +422,8 @@ void CNpc::init() Pos.vx = 100; Pos.vy = 100; + m_base = Pos; + m_timerFunc = m_data[this->m_type].timerFunc; m_sensorFunc = m_data[this->m_type].sensorFunc; @@ -464,6 +490,21 @@ void CNpc::init() break; } + case NPC_INIT_MOTHER_JELLYFISH: + { + m_state = MOTHER_JELLYFISH_RETURN_TO_START; + + break; + } + + case NPC_FLYING_DUTCHMAN: + { + m_state = FLYING_DUTCHMAN_ATTACK_PLAYER_1; + m_extendDir = EXTEND_UP; + + break; + } + default: break; @@ -576,7 +617,7 @@ bool CNpc::processSensor() m_controlFunc = NPC_CONTROL_CLOSE; m_extension = 0; m_velocity = 5; - m_extensionBase = Pos; + m_base = Pos; if ( playerPos.vx < Pos.vx ) { @@ -903,6 +944,20 @@ void CNpc::processMovement(int _frames) break; } + case NPC_MOVEMENT_MOTHER_JELLYFISH: + { + processMotherJellyfishMovement( _frames ); + + break; + } + + case NPC_MOVEMENT_FLYING_DUTCHMAN: + { + processFlyingDutchmanMovement( _frames ); + + break; + } + default: break; @@ -1000,6 +1055,16 @@ void CNpc::processClose(int _frames) break; + case NPC_CLOSE_MOTHER_JELLYFISH_ATTACK: + processCloseMotherJellyfishAttack( _frames ); + + break; + + case NPC_CLOSE_FLYING_DUTCHMAN_ATTACK: + processCloseFlyingDutchmanAttack( _frames ); + + break; + default: break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index caba7c5a7..c0683c72c 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -57,6 +57,8 @@ public: NPC_SHARK_MAN, NPC_OIL_BLOB, NPC_SKULL_STOMPER, + NPC_MOTHER_JELLYFISH, + NPC_FLYING_DUTCHMAN, NPC_UNIT_TYPE_MAX, }; @@ -77,6 +79,8 @@ protected: NPC_INIT_ACID, NPC_INIT_GHOST_PIRATE, NPC_INIT_SKULL_STOMPER, + NPC_INIT_MOTHER_JELLYFISH, + NPC_INIT_FLYING_DUTCHMAN, }; enum NPC_CONTROL_FUNC @@ -117,6 +121,8 @@ protected: NPC_CLOSE_EYEBALL_ATTACK, NPC_CLOSE_SKULL_STOMPER_ATTACK, NPC_CLOSE_BOOGER_MONSTER_ATTACK, + NPC_CLOSE_MOTHER_JELLYFISH_ATTACK, + NPC_CLOSE_FLYING_DUTCHMAN_ATTACK, }; enum NPC_MOVEMENT_FUNC @@ -125,6 +131,8 @@ protected: NPC_MOVEMENT_FIXED_PATH = 1, NPC_MOVEMENT_USER_SEEK, NPC_MOVEMENT_VERTICAL, + NPC_MOVEMENT_MOTHER_JELLYFISH, + NPC_MOVEMENT_FLYING_DUTCHMAN, }; enum NPC_MOVEMENT_MODIFIER_FUNC @@ -141,6 +149,20 @@ protected: NPC_TIMER_ATTACK_DONE, }; + enum NPC_MOTHER_JELLYFISH_STATE + { + MOTHER_JELLYFISH_RETURN_TO_START = 0, + MOTHER_JELLYFISH_CYCLE = 1, + MOTHER_JELLYFISH_ATTACK_PLAYER, + }; + + enum NPC_FLYING_DUTCHMAN_STATE + { + FLYING_DUTCHMAN_ATTACK_PLAYER_1 = 0, + FLYING_DUTCHMAN_ATTACK_PLAYER_2 = 1, + FLYING_DUTCHMAN_ATTACK_PLAYER_3, + }; + enum { NPC_JELLYFISH_RESISTANCE = 64, @@ -176,6 +198,7 @@ protected: void processCollision(); void processTimer( int _frames ); + void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ); void processCloseGenericUserSeek( int _frames ); // small jellyfish functions @@ -217,6 +240,16 @@ protected: void processCloseBoogerMonsterAttack( int _frames ); + // mother jellyfish functions + + void processMotherJellyfishMovement( int _frames ); + void processCloseMotherJellyfishAttack( int _frames ); + + // flying dutchman functions + + void processFlyingDutchmanMovement( int _frames ); + void processCloseFlyingDutchmanAttack( int _frames ); + // data static NPC_DATA m_data[NPC_UNIT_TYPE_MAX]; @@ -236,7 +269,8 @@ protected: s32 m_timerTimer; s32 m_extension; bool m_extendDir; - DVECTOR m_extensionBase; + DVECTOR m_base; + u8 m_state; }; diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index ee51679d8..d6de50bd3 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -41,20 +41,20 @@ void CNpc::processCloseSpiderCrabAttack( int _frames ) m_heading = 2048; } - s32 horizontalExtension = abs( Pos.vx - m_extensionBase.vx ); + s32 horizontalExtension = abs( Pos.vx - m_base.vx ); if ( horizontalExtension > 128 ) { if ( m_extendDir == EXTEND_RIGHT ) { - Pos.vx = m_extensionBase.vx + 128; + Pos.vx = m_base.vx + 128; } else { - Pos.vx = m_extensionBase.vx - 128; + Pos.vx = m_base.vx - 128; } - Pos.vy = m_extensionBase.vy; + Pos.vy = m_base.vy; m_controlFunc = NPC_CONTROL_MOVEMENT; m_timerFunc = NPC_TIMER_ATTACK_DONE; @@ -63,6 +63,6 @@ void CNpc::processCloseSpiderCrabAttack( int _frames ) } else { - Pos.vy = m_extensionBase.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 ); + Pos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 ); } } diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index c86b10ece..a14a4768b 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -141,6 +141,10 @@ SOURCE=..\..\..\source\enemy\neyeball.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nfdutch.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\ngeneric.cpp # End Source File # Begin Source File @@ -149,7 +153,7 @@ SOURCE=..\..\..\source\enemy\ngpirate.cpp # End Source File # Begin Source File -SOURCE=..\..\..\source\enemy\nnsfish.cpp +SOURCE=..\..\..\source\enemy\nmjfish.cpp # End Source File # Begin Source File