mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 21:16:55 +03:00
Decompiled doberman
This commit is contained in:
parent
e21f34c631
commit
f13f497f3b
4 changed files with 214 additions and 32 deletions
|
@ -74,6 +74,6 @@ void FallingBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
|||
void FallingBlockControl(short itemNumber);
|
||||
void FallingBlockFloor(ITEM_INFO* item, int x, int y, int z, int* height);
|
||||
void FallingBlockCeiling(ITEM_INFO* item, int x, int y, int z, int* height);
|
||||
void InitialiseWreckingBall(short itemNumber);
|
||||
void WreckingBallCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
||||
void _WreckingBallControl(short itemNumber);
|
||||
void InitialiseWreckingBall(short itemNumber);
|
||||
void WreckingBallCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
||||
void _WreckingBallControl(short itemNumber);
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#include "../newobjects.h"
|
||||
#include "../../Game/Box.h"
|
||||
#include "../../Game/effects.h"
|
||||
|
||||
BITE_INFO DobermanBite = { 0, 0x1E, 0x8D, 0x14 };
|
||||
|
||||
void InitialiseDoberman(short itemNum)
|
||||
{
|
||||
|
@ -9,7 +13,7 @@ void InitialiseDoberman(short itemNum)
|
|||
{
|
||||
item->currentAnimState = 5;
|
||||
item->animNumber = Objects[item->objectNumber].animIndex + 6;
|
||||
// TODO: item->flags2 ^= (item->flags2 ^ ((item->flags2 & 0xFE) + 2)) & 6;
|
||||
// TODO: item->flags2 ^= (item->flags2 ^ ((item->flags2 & 0xFE) + 2)) & 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,4 +21,202 @@ void InitialiseDoberman(short itemNum)
|
|||
item->animNumber = Objects[item->objectNumber].animIndex + 10;
|
||||
}
|
||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||
}
|
||||
|
||||
void ControlDoberman(short itemNumber)
|
||||
{
|
||||
if (CreatureActive(itemNumber))
|
||||
{
|
||||
short angle = 0;
|
||||
short tilt = 0;
|
||||
short joint = 0;
|
||||
|
||||
ITEM_INFO* item = &Items[itemNumber];
|
||||
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
||||
|
||||
if (item->hitPoints > 0)
|
||||
{
|
||||
AI_INFO info;
|
||||
CreatureAIInfo(item, &info);
|
||||
|
||||
if (info.ahead)
|
||||
joint = info.angle;
|
||||
|
||||
GetCreatureMood(item, &info, TIMID);
|
||||
CreatureMood(item, &info, TIMID);
|
||||
|
||||
angle = CreatureTurn(item, creature->maximumTurn);
|
||||
|
||||
int random;
|
||||
|
||||
switch (item->currentAnimState)
|
||||
{
|
||||
case 1:
|
||||
creature->maximumTurn = ANGLE(3);
|
||||
if (creature->mood)
|
||||
{
|
||||
item->goalAnimState = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
random = GetRandomControl();
|
||||
if (random < 768)
|
||||
{
|
||||
item->requiredAnimState = 4;
|
||||
item->goalAnimState = 3;
|
||||
break;
|
||||
}
|
||||
if (random < 1536)
|
||||
{
|
||||
item->requiredAnimState = 5;
|
||||
item->goalAnimState = 3;
|
||||
break;
|
||||
}
|
||||
if (random < 2816)
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tilt = angle;
|
||||
creature->maximumTurn = ANGLE(6);
|
||||
if (!creature->mood)
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
break;
|
||||
}
|
||||
if (info.distance < SQUARE(768))
|
||||
item->goalAnimState = 8;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
creature->maximumTurn = 0;
|
||||
creature->flags = 0;
|
||||
if (creature->mood)
|
||||
{
|
||||
if (creature->mood != ESCAPE_MOOD
|
||||
&& info.distance < SQUARE(341)
|
||||
&& info.ahead)
|
||||
item->goalAnimState = 7;
|
||||
else
|
||||
item->goalAnimState = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->requiredAnimState)
|
||||
{
|
||||
item->goalAnimState = item->requiredAnimState;
|
||||
}
|
||||
else
|
||||
{
|
||||
random = GetRandomControl();
|
||||
if (random >= 768)
|
||||
{
|
||||
if (random >= 1536)
|
||||
{
|
||||
if (random < 9728)
|
||||
item->goalAnimState = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (creature->mood || GetRandomControl() < 1280)
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (creature->mood || GetRandomControl() < 256)
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (creature->mood || GetRandomControl() < 512)
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
creature->maximumTurn = ANGLE(1) / 2;
|
||||
if (creature->flags != 1
|
||||
&& info.ahead
|
||||
&& item->touchBits & 0x122000)
|
||||
{
|
||||
CreatureEffect(item, &DobermanBite, DoBloodSplat);
|
||||
LaraItem->hitPoints -= 30;
|
||||
LaraItem->hitStatus = true;
|
||||
creature->flags = 1;
|
||||
}
|
||||
|
||||
if (info.distance <= SQUARE(341) || info.distance >= SQUARE(682))
|
||||
item->goalAnimState = 3;
|
||||
else
|
||||
item->goalAnimState = 9;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (creature->flags != 2 && item->touchBits & 0x122000)
|
||||
{
|
||||
CreatureEffect(item, &DobermanBite, DoBloodSplat);
|
||||
LaraItem->hitPoints -= 80;
|
||||
LaraItem->hitStatus = true;
|
||||
creature->flags = 2;
|
||||
}
|
||||
if (info.distance >= SQUARE(341))
|
||||
{
|
||||
if (info.distance < SQUARE(682))
|
||||
item->goalAnimState = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 7;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
creature->maximumTurn = ANGLE(6);
|
||||
if (creature->flags != 3 && item->touchBits & 0x122000)
|
||||
{
|
||||
CreatureEffect(item, &DobermanBite, DoBloodSplat);
|
||||
LaraItem->hitPoints -= 50;
|
||||
LaraItem->hitStatus = true;
|
||||
creature->flags = 3;
|
||||
}
|
||||
if (info.distance < SQUARE(341))
|
||||
item->goalAnimState = 7;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (item->currentAnimState != 10)
|
||||
{
|
||||
item->animNumber = Objects[ID_DOG].animIndex + 13;
|
||||
item->currentAnimState = 10;
|
||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||
}
|
||||
|
||||
CreatureTilt(item, tilt);
|
||||
CreatureJoint(item, 0, 0);
|
||||
CreatureJoint(item, 1, joint);
|
||||
CreatureJoint(item, 2, 0);
|
||||
CreatureAnimation(itemNumber, angle, tilt);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
//#define ControlGuard ((void (__cdecl*)(short)) 0x0046F5E0)
|
||||
#define ControlSubmarine ((void (__cdecl*)(short)) 0x0045D3F0)
|
||||
#define ControlDoberman ((void (__cdecl*)(short)) 0x00428A10)
|
||||
//#define ControlDoberman ((void (__cdecl*)(short)) 0x00428A10)
|
||||
#define ControlDog ((void (__cdecl*)(short)) 0x0043B730)
|
||||
#define ControlReaper ((void (__cdecl*)(short)) 0x0045DAF0)
|
||||
#define ControlLarson ((void (__cdecl*)(short)) 0x0046A080)
|
||||
|
@ -54,4 +54,5 @@ void PushableBlockCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll)
|
|||
int TestBlockMovable(ITEM_INFO* item, int blokhite);
|
||||
int TestBlockPush(ITEM_INFO* item, int blokhite, unsigned short quadrant);
|
||||
int TestBlockPull(ITEM_INFO* item, int blokhite, short quadrant);
|
||||
void ControlGuard(short itemNum);
|
||||
void ControlGuard(short itemNum);
|
||||
void ControlDoberman(short itemNumber);
|
|
@ -1153,47 +1153,26 @@ void BaddyObjects()
|
|||
printf("lara not found !");
|
||||
}
|
||||
|
||||
// TODO: dummy slot test for other entity, need to be uncommented later, when the Objects[] is augmented !
|
||||
/*
|
||||
obj = &Objects[ID_SAS];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->biteOffset = 0;
|
||||
obj->initialise = InitialiseGuard;
|
||||
obj->collision = CreatureCollision;
|
||||
obj->control = ControlGuard;
|
||||
obj->collision = CreatureCollision;
|
||||
obj->shadowSize = UNIT_SHADOW / 2;
|
||||
obj->hitPoints = 40;
|
||||
obj->pivotLength = 50;
|
||||
obj->radius = 102;
|
||||
obj->pivotLength = 50;
|
||||
obj->intelligent = true;
|
||||
obj->saveAnim = true;
|
||||
obj->saveFlags = true;
|
||||
obj->saveHitpoints = true;
|
||||
obj->savePosition = true;
|
||||
obj->saveFlags = true;
|
||||
obj->saveAnim = true;
|
||||
obj->saveHitpoints = true;
|
||||
Bones[obj->boneIndex + 6 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
}
|
||||
*/
|
||||
|
||||
obj = &Objects[ID_SAS];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->initialise = InitialiseCreature;
|
||||
obj->control = Tr1LarsonControl;
|
||||
obj->collision = CreatureCollision;
|
||||
obj->shadowSize = UNIT_SHADOW / 2;
|
||||
obj->hitPoints = 50;
|
||||
obj->radius = 104;
|
||||
obj->intelligent = true;
|
||||
obj->savePosition = true;
|
||||
obj->saveFlags = true;
|
||||
obj->saveAnim = true;
|
||||
obj->saveHitpoints = true;
|
||||
Bones[obj->boneIndex + 6 * 4] |= ROT_Y;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_SWAT];
|
||||
if (obj->loaded)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue