diff options
| -rw-r--r-- | src/bossFuzzyBear.cpp | 8 | ||||
| -rw-r--r-- | src/bossSamurshai.cpp | 18 | ||||
| -rw-r--r-- | src/bossTopman.cpp | 2 | ||||
| -rw-r--r-- | src/shyguyGiants.cpp | 41 | ||||
| -rwxr-xr-x | src/thundercloud.cpp | 124 | 
5 files changed, 133 insertions, 60 deletions
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index 07dd483..d286b81 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -214,11 +214,11 @@ int daFuzzyBear_c::onCreate() {  	HitMeBaby.yDistToCenter = 0.0;  	if (BigBossFuzzyBear == 0) { -		HitMeBaby.xDistToEdge = 32.0; -		HitMeBaby.yDistToEdge = 32.0; } +		HitMeBaby.xDistToEdge = 30.0; +		HitMeBaby.yDistToEdge = 30.0; }  	else { -		HitMeBaby.xDistToEdge = 38.0; -		HitMeBaby.yDistToEdge = 38.0; } +		HitMeBaby.xDistToEdge = 35.0; +		HitMeBaby.yDistToEdge = 35.0; }  	HitMeBaby.category1 = 0x3;  	HitMeBaby.category2 = 0x0; diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index 98470b9..3afd72b 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -115,8 +115,8 @@ daSamurshai *daSamurshai::build() {  			apOther->someFlagByte |= 2;  			if (this->isDown == 0) {   				this->playEnemyDownSound1(); -				damage += 4; -				if (damage > 15) { doStateChange(&StateID_Outro); } +				damage += 5; +				if (damage >= 15) { doStateChange(&StateID_Outro); }  				else { doStateChange(&StateID_Damage); }  			}  		}  @@ -136,8 +136,8 @@ daSamurshai *daSamurshai::build() {  		apOther->someFlagByte |= 2;  		if (this->isDown == 0) {  -			damage += 6; -			if (damage > 15) { doStateChange(&StateID_Outro); } +			damage += 10; +			if (damage >= 15) { doStateChange(&StateID_Outro); }  			else { doStateChange(&StateID_Damage); }  		} @@ -149,7 +149,7 @@ daSamurshai *daSamurshai::build() {  	void daSamurshai::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {  		if (this->isDown == 0) {   			damage += 3; -			if (damage > 2) { doStateChange(&StateID_Outro); } +			if (damage >= 15) { doStateChange(&StateID_Outro); }  			else { doStateChange(&StateID_Damage); }  		}  	} @@ -157,7 +157,7 @@ daSamurshai *daSamurshai::build() {  	void daSamurshai::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){  		if (this->isDown == 0) {   			damage += 3; -			if (damage > 15) { doStateChange(&StateID_Outro); } +			if (damage >= 15) { doStateChange(&StateID_Outro); }  			else { doStateChange(&StateID_Damage); }  		} @@ -169,19 +169,19 @@ daSamurshai *daSamurshai::build() {  		damage += 4;  		SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &apOther->owner->rot, &apOther->owner->scale);  		PlaySoundAsync(this, SE_OBJ_FIREBALL_DISAPP); -		if (damage > 15) { doStateChange(&StateID_Outro); } +		if (damage >= 15) { doStateChange(&StateID_Outro); }  	}  	void daSamurshai::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {  		damage += 1;  		SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &apOther->owner->rot, &apOther->owner->scale);  		PlaySoundAsync(this, SE_OBJ_FIREBALL_DISAPP);		 -		if (damage > 15) { doStateChange(&StateID_Outro); } +		if (damage >= 15) { doStateChange(&StateID_Outro); }  	}  	bool daSamurshai::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return true; }  	void daSamurshai::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {  		damage += 2;  		this->spawnHitEffectAtPosition((Vec2){apOther->owner->pos.x, apOther->owner->pos.y}); -		if (damage > 15) { doStateChange(&StateID_Outro); } +		if (damage >= 15) { doStateChange(&StateID_Outro); }  	} diff --git a/src/bossTopman.cpp b/src/bossTopman.cpp index 95aeefb..4b864ec 100644 --- a/src/bossTopman.cpp +++ b/src/bossTopman.cpp @@ -134,7 +134,7 @@ daDreidel *daDreidel::build() {  			this->damage += 1;  			doStateChange(&StateID_Damage); -			if (this->damage = 3) { doStateChange(&StateID_Outro); } +			if (this->damage == 3) { doStateChange(&StateID_Outro); }  		}  		else { dEn_c::spriteCollision(apThis, apOther); }  	} diff --git a/src/shyguyGiants.cpp b/src/shyguyGiants.cpp index 21529fc..e6789d8 100644 --- a/src/shyguyGiants.cpp +++ b/src/shyguyGiants.cpp @@ -80,6 +80,17 @@ class daShyGuyGiant : public dEn_c {  	void addScoreWhenHit(void *other);  	void bouncePlayerWhenJumpedOn(void *player); +	void spawnHitEffectAtPosition(Vec2 pos); +	void doSomethingWithHardHitAndSoftHitEffects(Vec pos); +	void playEnemyDownSound2(); +	void playHpdpSound1(); // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H +	void playEnemyDownSound1(); +	void playEnemyDownComboSound(void *player); // AcPy_c/daPlBase_c? +	void playHpdpSound2(); // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H +	void _vf260(void *other); // AcPy/PlBase? plays the SE_EMY_FUMU_%d sounds based on some value +	void _vf264(dStageActor_c *other); // if other is player or yoshi, do Wm_en_hit and a few other things +	void _vf268(void *other); // AcPy/PlBase? plays the SE_EMY_DOWN_SPIN_%d sounds based on some value +  	USING_STATES(daShyGuyGiant);  	DECLARE_STATE(RealWalk);  	DECLARE_STATE(RealTurn); @@ -128,11 +139,11 @@ daShyGuyGiant *daShyGuyGiant::build() {  		hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);  		if (hitType == 1) {	// regular jump  			PlaySound(this, SE_EMY_CMN_STEP); -			this->counter_504[apOther->owner->which_player] = 0x1C; +			this->counter_504[apOther->owner->which_player] = 0xA;  		}   		else if(hitType == 3){  			PlaySound(this, SE_EMY_CMN_STEP); -			this->counter_504[apOther->owner->which_player] = 0x1C; +			this->counter_504[apOther->owner->which_player] = 0xA;  		}  		else if(hitType == 0) {  			this->dEn_c::playerCollision(apThis, apOther); @@ -188,6 +199,18 @@ daShyGuyGiant *daShyGuyGiant::build() {  	void daShyGuyGiant::addScoreWhenHit(void *other) { } +	void daShyGuyGiant::spawnHitEffectAtPosition(Vec2 pos) { } +	void daShyGuyGiant::doSomethingWithHardHitAndSoftHitEffects(Vec pos) { } +	void daShyGuyGiant::playEnemyDownSound2() { } +	void daShyGuyGiant::playHpdpSound1() { } // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H +	void daShyGuyGiant::playEnemyDownSound1() { } +	void daShyGuyGiant::playEnemyDownComboSound(void *player) { } // AcPy_c/daPlBase_c? +	void daShyGuyGiant::playHpdpSound2() { } // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H +	void daShyGuyGiant::_vf260(void *other) { } // AcPy/PlBase? plays the SE_EMY_FUMU_%d sounds based on some value +	void daShyGuyGiant::_vf264(dStageActor_c *other) { } // if other is player or yoshi, do Wm_en_hit and a few other things +	void daShyGuyGiant::_vf268(void *other) { } // AcPy/PlBase? plays the SE_EMY_DOWN_SPIN_%d sounds based on some value + +  bool daShyGuyGiant::calculateTileCollisions() {  	// Returns true if sprite should turn, false if not. @@ -267,21 +290,23 @@ void daShyGuyGiant::bindAnimChr_and_setUpdateRate(const char* name, int unk, flo  int daShyGuyGiant::onCreate() {  	OSReport("Spawning Shy Guy"); -	this->type = this->settings >> 28 & 0xF; +	this->type = (this->settings >> 28) & 0xF;  	allocator.link(-1, GameHeaps[0], 0, 0x20); +	u32 colour = (this->settings >> 24) & 0xF; +  	// Shy Guy Colours -	if (this->settings >> 24 & 0xF == 1) { +	if (colour == 1) {  		this->resFile.data = getResource("shyguy", "g3d/ShyGuyBlue.brres");  	} -	else if (this->settings >> 24 & 0xF == 2) { +	else if (colour == 2) {  		this->resFile.data = getResource("shyguy", "g3d/ShyGuyGreen.brres");  	} -	else if (this->settings >> 24 & 0xF == 3) { +	else if (colour == 3) {  		this->resFile.data = getResource("shyguy", "g3d/ShyGuyCyan.brres");  	} -	else if (this->settings >> 24 & 0xF == 4) { +	else if (colour == 4) {  		this->resFile.data = getResource("shyguy", "g3d/ShyGuyPurple.brres");  	}  	else { @@ -365,7 +390,7 @@ int daShyGuyGiant::onCreate() {  	HitMeBaby.category1 = 0x3;  	HitMeBaby.category2 = 0x9;  	HitMeBaby.bitfield1 = 0x4F; -	HitMeBaby.bitfield2 = 0xffbafffe; +	HitMeBaby.bitfield2 = 0xffba7ffe;  	HitMeBaby.unkShort1C = 0x20000;  	HitMeBaby.callback = ­CollisionCallback; diff --git a/src/thundercloud.cpp b/src/thundercloud.cpp index 5ba1143..28778db 100755 --- a/src/thundercloud.cpp +++ b/src/thundercloud.cpp @@ -28,6 +28,8 @@ class dThunderCloud : public dEn_c {  	int dying;  	char killFlag;  	bool stationary; +	float leader; +	pointSensor_s below;  	u64 eventFlag; @@ -59,6 +61,8 @@ class dThunderCloud : public dEn_c {  	void _vf14C();  	bool CreateIceActors(); +	void lightningStrike(); +  	USING_STATES(dThunderCloud);  	DECLARE_STATE(Follow);  	DECLARE_STATE(Lightning); @@ -83,17 +87,20 @@ CREATE_STATE(dThunderCloud, Wait);  	extern "C" int CheckExistingPowerup(void * Player);  	void dThunderCloud::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {  -		if (apThis->info.category2 == 0x9) { -			int p = CheckExistingPowerup(apOther->owner); -			if (p != 0 && p != 3) {	// Powerups - 0 = small; 1 = big; 2 = fire; 3 = mini; 4 = prop; 5 = peng; 6 = ice; 7 = hammer -				dAcPy_c__ChangePowerupWithAnimation(apOther->owner, 3); + +		if (this->counter_504[apOther->owner->which_player]) { +			if (apThis->info.category2 == 0x9) { +				int p = CheckExistingPowerup(apOther->owner); +				if (p != 0 && p != 3) {	// Powerups - 0 = small; 1 = big; 2 = fire; 3 = mini; 4 = prop; 5 = peng; 6 = ice; 7 = hammer +					dAcPy_c__ChangePowerupWithAnimation(apOther->owner, 3); +				} +				else { dAcPy_vf3F4(apOther->owner, this, 9); }  			} +  			else { dAcPy_vf3F4(apOther->owner, this, 9); }  		} -		else { dAcPy_vf3F4(apOther->owner, this, 9); } - -		this->counter_504[apOther->owner->which_player] = 0x40; +		this->counter_504[apOther->owner->which_player] = 0x20;  	}  	void dThunderCloud::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } @@ -194,7 +201,6 @@ void dThunderCloud::bindAnimChr_and_setUpdateRate(const char* name, int unk, flo  	this->anm.setUpdateRate(rate);  } -  int dThunderCloud::onCreate() {  	// Setup the model @@ -220,7 +226,7 @@ int dThunderCloud::onCreate() {  	Cloud.category2 = 0x0;  	Cloud.bitfield1 = 0x4F; -	Cloud.bitfield2 = 0xffbafffe;  +	Cloud.bitfield2 = 0xffba7ffe;   	Cloud.xDistToEdge = 18.0;  	Cloud.yDistToEdge = 12.0; @@ -230,23 +236,9 @@ int dThunderCloud::onCreate() {  	this->aPhysics.initWithStruct(this, &Cloud);  	this->aPhysics.addToList(); - -	ActivePhysics::Info Shock; -	Shock.xDistToCenter = 0.0; -	Shock.yDistToCenter = -104.0; -	Shock.category1 = 0x3; -	Shock.category2 = 0x9; -	Shock.bitfield1 = 0x4F; - -	Shock.bitfield2 = 0xffbafffe;  -	Shock.xDistToEdge = 12.0; -	Shock.yDistToEdge = 90.0; - -	Shock.unkShort1C = 0; -	Shock.callback = &dEn_c::collisionCallback; - -	this->Lightning.initWithStruct(this, &Shock); - +	below.x = 0; +	below.y = 0; +	collMgr.init(this, &below, 0, 0);  	// Some Settings  	this->Baseline = this->pos.y; @@ -331,17 +323,17 @@ void dThunderCloud::executeState_Follow() {  	float speedDelta;  	speedDelta = 0.05; -	if (this->direction == 0) { -		this->speed.x = this->speed.x + speedDelta; +	if (this->direction == 0) { // Going Left +		this->speed.x = this->speed.x + speedDelta; //  -		if (this->speed.x < 0) { this->speed.x = this->speed.x + (speedDelta / 1.5); } -		if (this->speed.x < 6.0) { this->speed.x = this->speed.x + (speedDelta); } +		if (this->speed.x < 0) { this->speed.x += (speedDelta / 1.5); } +		if (this->speed.x < -6.0) { this->speed.x += (speedDelta * 2.0); }  	} -	else { +	else { // Going Right  		this->speed.x = this->speed.x - speedDelta; -		if (this->speed.x > 0) { this->speed.x = this->speed.x - (speedDelta / 1.5); } -		if (this->speed.x > 6.0) { this->speed.x = this->speed.x - (speedDelta); } +		if (this->speed.x > 0) { this->speed.x -= (speedDelta / 1.5); } +		if (this->speed.x > 6.0) { this->speed.x -= (speedDelta * 2.0); }  	}  	this->HandleXSpeed(); @@ -394,9 +386,52 @@ void dThunderCloud::endState_Wait() { }  // Lightning State +void dThunderCloud::lightningStrike() { +	PlaySound(this, SE_OBJ_KAZAN_ERUPTION);  + +	float boltsize = (leader-14.0)/2; +	float boltpos = -boltsize - 14.0; + +	ActivePhysics::Info Shock; +	Shock.xDistToCenter = 0.0; +	Shock.yDistToCenter = boltpos; +	Shock.category1 = 0x3; +	Shock.category2 = 0x9; +	Shock.bitfield1 = 0x4F; + +	Shock.bitfield2 = 0xffba7ffe;  +	Shock.xDistToEdge = 12.0; +	Shock.yDistToEdge = boltsize; + +	Shock.unkShort1C = 0; +	Shock.callback = &dEn_c::collisionCallback; + +	this->Lightning.initWithStruct(this, &Shock); +	this->Lightning.addToList(); +} +  void dThunderCloud::beginState_Lightning() {  	this->timer = 0;  	this->speed.x = 0.0; + +	float backupY = pos.y, backupYSpeed = speed.y; + +	u32 result = 0; +	while (result == 0) { +		below.y -= 0x8000; +		OSReport("Sending out leader to %d", below.y>>12); + +		result = collMgr.calculateBelowCollisionWithSmokeEffect(); +		OSReport("Result %d", result); +	} + +	OSReport("Lightning strikes at %d", below.y>>12); + +	leader = -(below.y >> 12); +	below.y = 0; + +	pos.y = backupY; +	speed.y = backupYSpeed;  }  void dThunderCloud::executeState_Lightning() {  @@ -407,13 +442,14 @@ void dThunderCloud::executeState_Lightning() {  		case 1:  			charge.spawn("Wm_en_birikyu", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5});  			break; -		case 2: -			this->Lightning.addToList(); +		case 2:		  			PlaySound(this, SE_BOSS_JR_ELEC_APP);   			PlaySound(this, SE_BOSS_JR_DAMAGE_ELEC);  -			PlaySound(this, SE_OBJ_KAZAN_ERUPTION);  -			bolt.spawn("Wm_jr_electricline", 0, &(Vec){pos.x, pos.y - 98.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 2.5, 1.0}); +			float boltsize = (leader-14.0)/2; +			float boltpos = -boltsize - 14.0; + +			bolt.spawn("Wm_jr_electricline", 0, &(Vec){pos.x, pos.y + boltpos, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, boltsize/36.0, 1.0});  			break;  		case 3:  			this->Lightning.removeFromList(); @@ -433,7 +469,10 @@ void dThunderCloud::executeState_Lightning() {  	if(this->anm.isAnimationDone() && this->anm.getCurrentFrame() != 0.0) {  		this->timer += 1; -		if (timer == 2) { this->bindAnimChr_and_setUpdateRate("thundershoot", 1, 0.0, 1.0); } +		if (timer == 2) {  +			this->bindAnimChr_and_setUpdateRate("thundershoot", 1, 0.0, 1.0);  +			lightningStrike(); +		}  		if (timer == 3) { this->bindAnimChr_and_setUpdateRate("cloud_wait", 1, 0.0, 1.0); }  		this->anm.setCurrentFrame(0.0); } @@ -443,3 +482,12 @@ void dThunderCloud::endState_Lightning() {  } +// Thundercloud center = 0 +// Thundercloud bottom = -12 +// Thundercloud boltpos = -boltsize/2 - 14.0 +// Thundercloud boltsize = (leader-14.0)/2 +// Thundercloud effSize = 36.0 [*2] +// Thundercloud effScale = boltsize / effSize +// Thundercloud effPos = -boltsize/2 - 14.0 + +  | 
