summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-04-16 18:45:20 +0200
committerTreeki <treeki@gmail.com>2013-04-16 18:45:20 +0200
commite0d004e290b52099d2fc85fdbb9485a47bb9c40a (patch)
treefd992924d677b45e6200c15d6a3ccf6e4109e361
parent48a2b6726e313154b6bc94b3d02251599ec62b66 (diff)
downloadkamek-e0d004e290b52099d2fc85fdbb9485a47bb9c40a.tar.gz
kamek-e0d004e290b52099d2fc85fdbb9485a47bb9c40a.zip
various chestnut bugfixes
Diffstat (limited to '')
-rw-r--r--src/chestnut.cpp46
1 files changed, 35 insertions, 11 deletions
diff --git a/src/chestnut.cpp b/src/chestnut.cpp
index 10ff076..7ebfc4d 100644
--- a/src/chestnut.cpp
+++ b/src/chestnut.cpp
@@ -20,9 +20,12 @@ class daEnChestnut_c : public dEn_c {
int starCoinNumber;
bool ignorePlayers;
bool breaksBlocks;
+ float shakeWindow, fallWindow;
int timeSpentExploding;
+ lineSensor_s belowSensor;
+
float nearestPlayerDistance();
int onCreate();
@@ -66,6 +69,14 @@ int daEnChestnut_c::onCreate() {
breaksBlocks = ((settings & 0x2000) != 0);
objNumber = (settings & 0xF0000) >> 16;
+ if ((settings & 0x4000) != 0) {
+ shakeWindow = 96.0f;
+ fallWindow = 64.0f;
+ } else {
+ shakeWindow = 64.0f;
+ fallWindow = 32.0f;
+ }
+
// Set up models
allocator.link(-1, GameHeaps[0], 0, 0x20);
@@ -92,7 +103,7 @@ int daEnChestnut_c::onCreate() {
ActivePhysics::Info ccInfo;
ccInfo.xDistToCenter = 0.0f;
ccInfo.xDistToEdge = 12.0f * scale.x;
- ccInfo.yDistToCenter = 12.0f * scale.y;
+ ccInfo.yDistToCenter = 1.0f + (12.0f * scale.y);
ccInfo.yDistToEdge = 12.0f * scale.y;
ccInfo.category1 = 3;
@@ -171,9 +182,9 @@ void daEnChestnut_c::executeState_Idle() {
float dist = nearestPlayerDistance();
- if (dist < 32.0f)
+ if (dist < fallWindow)
doStateChange(&StateID_Fall);
- else if (dist < 64.0f)
+ else if (dist < shakeWindow)
doStateChange(&StateID_Shake);
}
@@ -191,9 +202,9 @@ void daEnChestnut_c::endState_Shake() { }
void daEnChestnut_c::executeState_Shake() {
float dist = nearestPlayerDistance();
- if (dist >= 64.0f)
+ if (dist >= shakeWindow)
doStateChange(&StateID_Idle);
- else if (dist < 32.0f)
+ else if (dist < fallWindow)
doStateChange(&StateID_Fall);
}
@@ -204,12 +215,16 @@ void daEnChestnut_c::beginState_Fall() {
int size = 12*scale.x;
- u32 sFlags = 0;
+ belowSensor.flags = SENSOR_LINE;
if (breaksBlocks)
- sFlags = SENSOR_BREAK_BLOCK | SENSOR_BREAK_BRICK;
+ belowSensor.flags |= SENSOR_10000000 | SENSOR_BREAK_BLOCK | SENSOR_BREAK_BRICK;
+ // 10000000 makes it pass through bricks
+
+ belowSensor.lineA = -size << 12;
+ belowSensor.lineB = size << 12;
+ belowSensor.distanceFromCenter = 0;
- static const lineSensor_s below(sFlags, -size << 12, size << 12, 0 << 12);
- collMgr.init(this, &below, 0, 0);
+ collMgr.init(this, &belowSensor, 0, 0);
speed.y = 0.0f;
y_speed_inc = -0.1875f;
@@ -226,7 +241,7 @@ void daEnChestnut_c::executeState_Fall() {
doSpriteMovement();
UpdateObjectPosBasedOnSpeedValuesReal();
- if (collMgr.calculateBelowCollision()) {
+ if (collMgr.calculateBelowCollision() & (~0x400000)) {
doStateChange(&StateID_Explode);
}
}
@@ -317,9 +332,18 @@ void daEnChestnut_c::spawnObject() {
acPos.y += 32.0f;
}
+ aPhysics.removeFromList();
+
OSReport("Crap %d, %d, %08x\n", objNumber, things[objNumber*2], acSettings);
- dStageActor_c::create((Actors)things[objNumber*2], acSettings, &acPos, 0, currentLayerID);
+ dStageActor_c *ac =
+ dStageActor_c::create((Actors)things[objNumber*2], acSettings, &acPos, 0, currentLayerID);
S16Vec efRot = {0,0,0};
SpawnEffect("Wm_ob_itemsndlandsmk", 0, &pos, &efRot, &scale);
+
+ if (objNumber == 0) {
+ dEn_c *en = (dEn_c*)ac;
+ en->direction = 1;
+ en->rot.y = -8192;
+ }
}