diff options
| author | Treeki <treeki@gmail.com> | 2013-05-28 01:33:29 +0200 | 
|---|---|---|
| committer | Treeki <treeki@gmail.com> | 2013-05-28 01:33:29 +0200 | 
| commit | d59e98050ca9a76733b65ac59105962ad16f4a54 (patch) | |
| tree | b2bcb30a1ea6f5fe75bd8e23698cedf275c05cb7 /src | |
| parent | e8c9c5cd3200a467dd40818586949c948d1f3044 (diff) | |
| download | kamek-d59e98050ca9a76733b65ac59105962ad16f4a54.tar.gz kamek-d59e98050ca9a76733b65ac59105962ad16f4a54.zip  | |
fixed shyguy until skawo finds a bug in it
Diffstat (limited to '')
| -rw-r--r-- | src/shyguy.cpp | 46 | 
1 files changed, 41 insertions, 5 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp index ddd2923..21e285e 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -112,6 +112,8 @@ class daShyGuy : public dEn_c {  	void _vf14C();  	bool CreateIceActors(); +	bool willWalkOntoSuitableGround(); +  	USING_STATES(daShyGuy);  	DECLARE_STATE(Walk);  	DECLARE_STATE(Turn); @@ -655,7 +657,7 @@ int daShyGuy::onCreate() {  	_324 = 16.0f;  	// These structs tell stupid collider what to collide with - these are from koopa troopa -	static const lineSensor_s below(-0<<12, 0<<12, 0<<12); +	static const lineSensor_s below(-6<<12, 6<<12, 0<<12);  	static const pointSensor_s above(0<<12, 12<<12);  	static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); @@ -1190,6 +1192,29 @@ void daShyGuy::updateModelMatrices() {  ///////////////  // Real Walk State  /////////////// +bool daShyGuy::willWalkOntoSuitableGround() { +	static const float deltas[] = {2.5f, -2.5f}; +	VEC3 checkWhere = { +			pos.x + deltas[direction], +			4.0f + pos.y, +			pos.z}; + +	u32 props = collMgr.getTileBehaviour2At(checkWhere.x, checkWhere.y, currentLayerID); + +	//if (getSubType(props) == B_SUB_LEDGE) +	if (((props >> 16) & 0xFF) == 8) +		return false; + +	float someFloat = 0.0f; +	if (collMgr.sub_800757B0(&checkWhere, &someFloat, currentLayerID, 1, -1)) { +		if (someFloat < checkWhere.y && someFloat > (pos.y - 5.0f)) +			return true; +	} + +	return false; +} + +  	void daShyGuy::beginState_RealWalk() {  		//inline this piece of code  		this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; @@ -1203,14 +1228,16 @@ void daShyGuy::updateModelMatrices() {  		chrAnimation.setUpdateRate(1.5f);  		if (distance) { +			// What the fuck. Somehow, having this code makes the shyguy not +			// fall through solid-on-top platforms...  			bool turn = collMgr.isOnTopOfTile();  			if (!turn) {  				if (!stillFalling) { -					stillFalling = 1; +					stillFalling = true;  					pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; -					doStateChange(&StateID_RealTurn); } -			} -			else { stillFalling = 0; } +					doStateChange(&StateID_RealTurn); +				} +			} else stillFalling = false;  		}  		bool ret = calculateTileCollisions(); @@ -1218,6 +1245,15 @@ void daShyGuy::updateModelMatrices() {  			doStateChange(&StateID_RealTurn);  		} +		if (distance) { +			if (collMgr.isOnTopOfTile()) { +				if (!willWalkOntoSuitableGround()) { +					pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; +					doStateChange(&StateID_RealTurn); +				} +			} +		} +  		if(this->chrAnimation.isAnimationDone()) {  			this->chrAnimation.setCurrentFrame(0.0);  		}  | 
