diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/apDebug.cpp | 15 | ||||
| -rw-r--r-- | src/boss.cpp | 4 | ||||
| -rw-r--r-- | src/bossBalboaWrench.cpp | 2 | ||||
| -rw-r--r-- | src/bossMegaGoomba.cpp | 198 | ||||
| -rw-r--r-- | src/bossSamurshai.cpp | 6 | ||||
| -rw-r--r-- | src/bossTopman.cpp | 2 | ||||
| -rw-r--r-- | src/penguin.cpp | 2 | ||||
| -rw-r--r-- | src/pumpkinGoomba.cpp | 2 | ||||
| -rw-r--r-- | src/shyguy.cpp | 8 | ||||
| -rw-r--r-- | src/topman.cpp | 4 | 
10 files changed, 183 insertions, 60 deletions
| diff --git a/src/apDebug.cpp b/src/apDebug.cpp index a352d4a..f485474 100644 --- a/src/apDebug.cpp +++ b/src/apDebug.cpp @@ -135,6 +135,21 @@ void APDebugDrawer::drawXlu() {  		float blX = centreX - edgeDistX, blY = centreY - edgeDistY;  		float brX = centreX + edgeDistX, brY = centreY - edgeDistY; +		switch (ap->collisionCheckType) { +			case 2: // vert trapezoid +				tlY = centreY + ap->trpValue0; +				trY = centreY + ap->trpValue1; +				blY = centreY + ap->trpValue2; +				brY = centreY + ap->trpValue3; +				break; +			case 3: // horz trapezoid +				tlX = centreX + ap->trpValue0; +				trX = centreX + ap->trpValue1; +				blX = centreX + ap->trpValue2; +				brX = centreX + ap->trpValue3; +				break; +		} +  		// Top  		GXPosition3f32(tlX, tlY, 8000.0f);  		GXColor4u8(r,g,b,a); diff --git a/src/boss.cpp b/src/boss.cpp index 057d98b..72e8121 100644 --- a/src/boss.cpp +++ b/src/boss.cpp @@ -8,7 +8,7 @@ void DamagePlayer(dEn_c *actor, ActivePhysics *apThis, ActivePhysics *apOther) {  	actor->_vf220(apOther->owner);  	// fix multiple player collisions via megazig -	actor->isDead = 0; +	actor->deathInfo.isDead = 0;  	actor->flags_4FC |= (1<<(31-7));  	if (apOther->owner->which_player == 255 ) {  		actor->counter_504[0] = 0; @@ -146,4 +146,4 @@ void PlayerVictoryCries(daBoss *actor) {  	if (GetSpecificPlayerActor(1) != 0) { PlaySound(actor, SE_VOC_LU_CLEAR_BOSS); }  	if (GetSpecificPlayerActor(2) != 0) { PlaySound(actor, SE_VOC_KO_CLEAR_BOSS); }  	if (GetSpecificPlayerActor(3) != 0) { PlaySound(actor, SE_VOC_KO2_CLEAR_BOSS); } -}
\ No newline at end of file +} diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index 6dfbe42..b760888 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -113,7 +113,7 @@ daBalboa_c *daBalboa_c::build() {  		}  		//FIXME hack to make multiple playerCollisions work -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 0214f60..cd20c4d 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -12,37 +12,8 @@ const char* MGarcNameList [] = {  	NULL	  }; -//Enable this if you're fixing it -void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { -	float amtX = scale->x; -	float amtY = scale->y; - -	// 0, 20.0, 18.0, 20.0 -	ActivePhysics::Info info; -	// info.xDistToCenter = 0.0; -	// info.yDistToCenter = 7.65 * amtY; -	// info.xDistToEdge   = 8.0 * amtX; -	// info.yDistToEdge   = 8.7 * amtY; - -	info.xDistToCenter = 0.0; -	info.yDistToCenter = 22.0 * amtY; -	info.xDistToEdge   = 18.0 * amtX; -	info.yDistToEdge   = 24.0 * amtY; - -	info.category1  = actor->aPhysics.info.category1; -	info.category2  = actor->aPhysics.info.category2; -	info.bitfield1  = actor->aPhysics.info.bitfield1; -	info.bitfield2  = actor->aPhysics.info.bitfield2; -	info.unkShort1C = actor->aPhysics.info.unkShort1C; -	info.callback   = actor->aPhysics.info.callback; - -	//OSReport("Making new Physics Class and adding to the list\n"); -	actor->aPhysics.removeFromList(); -	actor->aPhysics.initWithStruct(actor, &info); -	actor->aPhysics.addToList(); -} -  class daMegaGoomba_c : public dEn_c { +	public:  	int onCreate();  	int onDelete();  	int onExecute(); @@ -55,7 +26,13 @@ class daMegaGoomba_c : public dEn_c {  	float timer;  	float dying; -	 + +	lineSensor_s belowSensor; +	pointSensor_s adjacentSensor; + +	ActivePhysics leftTrapAPhysics, rightTrapAPhysics; +	ActivePhysics stalkAPhysics; +  	HermiteKey keysX[0x10];  	unsigned int Xkey_count;  	HermiteKey keysY[0x10]; @@ -90,6 +67,9 @@ class daMegaGoomba_c : public dEn_c {  	bool playerStunned[4]; +	void removeMyActivePhysics(); +	void addMyActivePhysics(); +  	// bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);  	// bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther);  //	bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -115,6 +95,10 @@ class daMegaGoomba_c : public dEn_c {  	void _vf110(ActivePhysics *apThis, ActivePhysics *apOther);  	void _vf108(ActivePhysics *apThis, ActivePhysics *apOther); +	void dieOther_Begin(); +	void dieOther_Execute(); +	void dieOther_End(); +  	USING_STATES(daMegaGoomba_c);  	// DECLARE_STATE(Grow);  	DECLARE_STATE(Shrink); @@ -134,6 +118,89 @@ daMegaGoomba_c *daMegaGoomba_c::build() {  } +void daMegaGoomba_c::removeMyActivePhysics() { +	aPhysics.removeFromList(); +	stalkAPhysics.removeFromList(); +	leftTrapAPhysics.removeFromList(); +	rightTrapAPhysics.removeFromList(); +} + +void daMegaGoomba_c::addMyActivePhysics() { +	aPhysics.addToList(); +	stalkAPhysics.addToList(); +	leftTrapAPhysics.addToList(); +	rightTrapAPhysics.addToList(); +} + + +void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) { +	float amtX = scale->x * 0.5f; +	float amtY = scale->y * 0.5f; + +	actor->belowSensor.flags = SENSOR_LINE; +	actor->belowSensor.lineA = s32((amtX * -28.0f) * 4096.0f); +	actor->belowSensor.lineB = s32((amtX * 28.0f) * 4096.0f); +	actor->belowSensor.distanceFromCenter = s32((amtY * 4) * 4096.0f); + +	actor->adjacentSensor.flags = SENSOR_POINT; +	actor->adjacentSensor.x = s32((amtX * 32.0f) * 4096.0f); +	actor->adjacentSensor.y = s32((amtY * 22.0f) * 4096.0f); + +	// 0, 20.0, 18.0, 20.0 +	ActivePhysics::Info info; +	// info.xDistToCenter = 0.0; +	// info.yDistToCenter = 7.65 * amtY; +	// info.xDistToEdge   = 8.0 * amtX; +	// info.yDistToEdge   = 8.7 * amtY; + +	info.xDistToCenter = 0.0f; +	info.yDistToCenter = 57.0f * amtY; +	info.xDistToEdge   = 14.0f * amtX; +	info.yDistToEdge   = 32.0f * amtY; + +	info.category1  = actor->aPhysics.info.category1; +	info.category2  = actor->aPhysics.info.category2; +	info.bitfield1  = actor->aPhysics.info.bitfield1; +	info.bitfield2  = actor->aPhysics.info.bitfield2; +	info.unkShort1C = actor->aPhysics.info.unkShort1C; +	info.callback   = actor->aPhysics.info.callback; + +	/*actor->aPhysics.trpValue0 = amtX * -12.0f; +	actor->aPhysics.trpValue1 = amtX * 12.0f; +	actor->aPhysics.trpValue2 = amtX * -48.0f; +	actor->aPhysics.trpValue3 = amtX * 48.0f;*/ + +	actor->aPhysics.initWithStruct(actor, &info); + +	// Original trapezium was -12,12 to -48,48 +	ActivePhysics::Info left = { +		amtX*-28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, +		3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; +	actor->leftTrapAPhysics.initWithStruct(actor, &left); +	actor->leftTrapAPhysics.trpValue0 = amtX * 14.0f; +	actor->leftTrapAPhysics.trpValue1 = amtX * 14.0f; +	actor->leftTrapAPhysics.trpValue2 = amtX * -14.0f; +	actor->leftTrapAPhysics.trpValue3 = amtX * 14.0f; +	actor->leftTrapAPhysics.collisionCheckType = 3; + +	ActivePhysics::Info right = { +		amtX*28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, +		3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; +	actor->rightTrapAPhysics.initWithStruct(actor, &right); +	actor->rightTrapAPhysics.trpValue0 = amtX * -14.0f; +	actor->rightTrapAPhysics.trpValue1 = amtX * -14.0f; +	actor->rightTrapAPhysics.trpValue2 = amtX * -14.0f; +	actor->rightTrapAPhysics.trpValue3 = amtX * 14.0f; +	actor->rightTrapAPhysics.collisionCheckType = 3; + +	ActivePhysics::Info stalk = { +		0.0f, amtY*12.0f, amtX*28.0f, amtY*12.0f, +		3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; +	actor->stalkAPhysics.initWithStruct(actor, &stalk); + +} + +  //FIXME make this dEn_c->used...  extern "C" int SomeStrangeModification(dStageActor_c* actor);  extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); @@ -151,6 +218,7 @@ CREATE_STATE(daMegaGoomba_c, Turn);  //TODO better fix for possible bug with sign (ex. life=120; count=-9;)  bool daMegaGoomba_c::takeHit(char count) { +	OSReport("Taking a hit!\n");  	if(!this->already_hit) {  		int c = count;  		int l = this->life; @@ -188,6 +256,10 @@ void daMegaGoomba_c::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOth  	#endif  }  void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {  +	if (apThis == &stalkAPhysics) { +		dEn_c::playerCollision(apThis, apOther); +		return; +	}  	/* * * * * * * * * * * * * * * * * * * * *  	 * 0=normal??,1=dontHit,2=dontKill @@ -209,10 +281,17 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth  	//char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);  	char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); +//	OSReport("I hate my life: %d\n", ret);  	if(ret == 1) {	// regular jump  		apOther->someFlagByte |= 2; -		if(this->takeHit(1)) -			doStateChange(&StateID_DieFall); +		if(this->takeHit(1)) { +			// kill me +			VEC2 eSpeed = {speed.x, speed.y}; +			OSReport("I'M DYING\n"); +			OSReport("State: %s\n", acState.getCurrentState()->getName()); +			killWithSpecifiedState(apOther->owner, &eSpeed, &dEn_c::StateID_DieOther); +			OSReport("State: %s\n", acState.getCurrentState()->getName()); +		}  	} else if(ret == 3) {	// spinning  		apOther->someFlagByte |= 2;  		if(this->takeHit(1)) @@ -224,10 +303,7 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth  	} else {  	} -	//FIXME hack to make multiple playerCollisions work -	this->isDead = 0; -	this->flags_4FC |= (1<<(31-7)); -	this->counter_504[apOther->owner->which_player] = 0; +	//this->flags_4FC |= (1<<(31-7));  }  void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) {   	OSReport("Ground Pounded"); @@ -242,10 +318,7 @@ void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePh  	// EN_LandbarrelPlayerCollision(this, apThis, apOther);  	// mario->speed.x += 16.0; - -	this->isDead = 0; -	this->flags_4FC |= (1<<(31-7)); -	this->counter_504[apOther->owner->which_player] = 0; +	//this->flags_4FC |= (1<<(31-7));  }  void daMegaGoomba_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {}  bool daMegaGoomba_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } @@ -313,9 +386,7 @@ void daMegaGoomba_c::setupCollision() {  	//POINTLESS WITH GROWTH  	this->scale.x = this->scale.y = this->scale.z = 0.666; -	static const lineSensor_s below(-12 << 12, 12 << 12, 0); -	static const pointSensor_s adjacent(16 << 12, 16 << 12); -	this->collMgr.init(this, &below, 0, &adjacent); +	this->collMgr.init(this, &belowSensor, 0, &adjacentSensor);  	char foo = this->_391;  	this->pos_delta2.x = 0.0; @@ -360,13 +431,25 @@ int daMegaGoomba_c::onCreate() {  	hm.yDistToEdge   = 12.0;  	hm.category1 = 0x3;  	hm.category2 = 0x0; -	hm.bitfield1 = 0x4f; +	hm.bitfield1 = 0x6f;  	hm.bitfield2 = 0xffbafffe;  	hm.unkShort1C = 0;  	hm.callback = &dEn_c::collisionCallback;  	this->aPhysics.initWithStruct(this, &hm);  	this->aPhysics.addToList(); +	ActivePhysics::Info stalk = { +		0.0f, 24.0f, 32.0f, 22.0f, +		3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; +	stalkAPhysics.initWithStruct(this, &stalk); +	stalkAPhysics.addToList(); + +	// for dummy purposes, we'll replace the info later +	leftTrapAPhysics.initWithStruct(this, &stalk); +	leftTrapAPhysics.addToList(); +	rightTrapAPhysics.initWithStruct(this, &stalk); +	rightTrapAPhysics.addToList(); +  	this->_120 |= 0x200;  	this->_36D = 0; @@ -404,6 +487,8 @@ int daMegaGoomba_c::onDelete() {  }  int daMegaGoomba_c::onExecute() { +	// what state am I in? +//	OSReport("State for %p: %s\n", this, acState.getCurrentState()->getName());  	//80033450  	acState.execute();  	//if(CheckSomethingEnemyRelated())		// checks class1EC bitfield @@ -411,6 +496,7 @@ int daMegaGoomba_c::onExecute() {  	//else  	//	dStageActor_c__checkZoneBoundaries(this, 0);  	//// dont do updateModelMatrices //// +	checkZoneBoundaries(0);  	updateModelMatrices(); @@ -799,3 +885,25 @@ void daMegaGoomba_c::unstunPlayers() {  	}  } + + +void daMegaGoomba_c::dieOther_Begin() { +	animationChr.bind(&bodyModel, resFile.GetResAnmChr("damage"), true); +	bodyModel.bindAnim(&animationChr, 2.0f); +	speed.x = speed.y = speed.z = 0.0f; +	removeMyActivePhysics(); + +	rot.y = 0; +	counter_500 = 60; +} + +void daMegaGoomba_c::dieOther_End() { +	dEn_c::dieOther_End(); +} + +void daMegaGoomba_c::dieOther_Execute() { +	bodyModel._vf1C(); +	if (counter_500 == 0) +		Delete(1); +} + diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index 9ed5b9a..91056f0 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -129,7 +129,7 @@ daSamurshai *daSamurshai::build() {  			this->_vf220(apOther->owner);  		}  -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} @@ -149,7 +149,7 @@ daSamurshai *daSamurshai::build() {  			else { doStateChange(&StateID_Damage); }  		} -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} @@ -169,7 +169,7 @@ daSamurshai *daSamurshai::build() {  			else { doStateChange(&StateID_Damage); }  		} -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} diff --git a/src/bossTopman.cpp b/src/bossTopman.cpp index 427682a..c35e5d1 100644 --- a/src/bossTopman.cpp +++ b/src/bossTopman.cpp @@ -196,7 +196,7 @@ daDreidel *daDreidel::build() {  			}  		}  -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  	} diff --git a/src/penguin.cpp b/src/penguin.cpp index 6febbae..f7c63d4 100644 --- a/src/penguin.cpp +++ b/src/penguin.cpp @@ -98,7 +98,7 @@ daPengi *daPengi::build() {  		}   		// fix multiple player collisions via megazig -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		if(apOther->owner->which_player < 4) {  			this->counter_504[apOther->owner->which_player] = 0; diff --git a/src/pumpkinGoomba.cpp b/src/pumpkinGoomba.cpp index 62f4e3f..f800dca 100644 --- a/src/pumpkinGoomba.cpp +++ b/src/pumpkinGoomba.cpp @@ -103,7 +103,7 @@ dGoombaPie *dGoombaPie::build() {  		}   		// fix multiple player collisions via megazig -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} diff --git a/src/shyguy.cpp b/src/shyguy.cpp index b2eef75..594d537 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -231,7 +231,7 @@ daShyGuy *daShyGuy::build() {  				this->dEn_c::playerCollision(apThis, apOther);  				this->_vf220(apOther->owner);  			}  -			this->isDead = 0; +			deathInfo.isDead = 0;  			this->flags_4FC |= (1<<(31-7));  			this->counter_504[apOther->owner->which_player] = 0;  			return; @@ -242,7 +242,7 @@ daShyGuy *daShyGuy::build() {  		}  		// fix multiple player collisions via megazig -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0; @@ -263,7 +263,7 @@ daShyGuy *daShyGuy::build() {  			else { // Shy Guy is in throwy mode - kill it with fire  				this->playEnemyDownSound1();  				doStateChange(deathState); -				this->isDead = 1; +				deathInfo.isDead = 1;  			}				  		}   		else if(hitType == 3) {	// spinning jump or whatever? @@ -275,7 +275,7 @@ daShyGuy *daShyGuy::build() {  			else { // Shy Guy is in throwy mode - kill it with fire  				this->playEnemyDownSound1();  				doStateChange(deathState); -				this->isDead = 1; +				deathInfo.isDead = 1;  			}				  		}   		else if(hitType == 0) { diff --git a/src/topman.cpp b/src/topman.cpp index 0c2865a..2119c03 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -125,7 +125,7 @@ daTopman *daTopman::build() {  		}   		// fix multiple player collisions via megazig -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} @@ -138,7 +138,7 @@ daTopman *daTopman::build() {  		this->dEn_c::playerCollision(apThis, apOther);  		this->_vf220(apOther->owner); -		this->isDead = 0; +		deathInfo.isDead = 0;  		this->flags_4FC |= (1<<(31-7));  		this->counter_504[apOther->owner->which_player] = 0;  	} | 
