More fixes to ID_BOAT; Improved snow and water effects; Cleaned skidoo;

This commit is contained in:
Montagna Marco 2020-09-13 15:53:37 +02:00
parent 542a728737
commit ab98a693af
4 changed files with 501 additions and 496 deletions

View file

@ -11,7 +11,7 @@
#include "sound.h"
#include <Game\effect2.h>
typedef struct BOAT_INFO
struct BOAT_INFO
{
int boat_turn;
int left_fallspeed;
@ -78,8 +78,6 @@ enum BOAT_STATE
#define SKIDOO_HIT_FRONT 13
#define SKIDOO_HIT_BACK 14
// TODO: (boat) render problem, water height problem, enter problem.
void DoBoatWakeEffect(ITEM_INFO* boat)
{
int c = phd_cos(boat->pos.yRot);
@ -93,40 +91,66 @@ void DoBoatWakeEffect(ITEM_INFO* boat)
int y = boat->pos.yPos;
int z = boat->pos.zPos + ((s * w) - (h * c) >> W2V_SHIFT);
for (int j = 0; j < 16; j++)
{
SPARKS* spark = &Sparks[GetFreeSpark()];
spark->on = 1;
spark->sR = 96;
spark->sG = 96;
spark->sB = 96;
spark->dR = 96;
spark->dG = 96;
spark->dB = 96;
spark->colFadeSpeed = 1;
spark->transType = COLADD;
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
spark->fadeToBlack = spark->life - 1;
int dl = GetRandomControl() % 1408 + 64;
spark->x = x + (GetRandomControl() & 255);
spark->y = y + (GetRandomControl() & 255);
spark->xVel = 0;
spark->zVel = 0;
spark->z = z + (GetRandomControl() & 255);
spark->friction = 0;
spark->flags = 10;
spark->yVel = GetRandomControl() & 0x100 + (GetRandomControl() & 0x7F) - 128;
spark->scalar = 2;
spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 17;
spark->gravity = 0;
spark->maxYvel = 0;
spark->sSize = spark->size = (GetRandomControl() & 7) + 8;
spark->dSize = spark->size * 2;
}
SPARKS* spark = &Sparks[GetFreeSpark()];
spark->on = 1;
spark->sR = 64;
spark->sG = 64;
spark->sB = 64;
spark->dR = 64;
spark->dG = 64;
spark->dB = 64;
spark->colFadeSpeed = 1;
spark->transType = COLADD;
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
spark->fadeToBlack = spark->life - 4;
spark->x = (BOAT_SIDE * phd_sin(boat->pos.yRot) >> W2V_SHIFT) + (GetRandomControl() & 128) + x - 8;
spark->y = (GetRandomControl() & 0xF) + y - 8;
spark->z = (BOAT_SIDE * phd_cos(boat->pos.yRot) >> W2V_SHIFT) + (GetRandomControl() & 128) + z - 8;
spark->xVel = 0;
spark->zVel = 0;
spark->friction = 0;
spark->flags = 538;
spark->yVel = (GetRandomControl() & 0x7F) - 256;
spark->rotAng = GetRandomControl() & 0xFFF;
spark->scalar = 3;
spark->maxYvel = 0;
spark->rotAdd = (GetRandomControl() & 0x1F) - 16;
spark->gravity = -spark->yVel >> 2;
spark->sSize = spark->size = ((GetRandomControl() & 3) + 16) * 16;
spark->dSize = 2 * spark->size;
spark = &Sparks[GetFreeSpark()];
spark->on = 1;
spark->sR = 64;
spark->sG = 64;
spark->sB = 64;
spark->dR = 64;
spark->dG = 64;
spark->dB = 64;
spark->colFadeSpeed = 1;
spark->transType = COLADD;
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
spark->fadeToBlack = spark->life - 4;
spark->x = (BOAT_SIDE * phd_sin(boat->pos.yRot) >> W2V_SHIFT) + (GetRandomControl() & 128) + x - 8;
spark->y = (GetRandomControl() & 0xF) + y - 8;
spark->z = (BOAT_SIDE * phd_cos(boat->pos.yRot) >> W2V_SHIFT) + (GetRandomControl() & 128) + z - 8;
spark->xVel = 0;
spark->zVel = 0;
spark->friction = 0;
spark->flags = 538;
spark->yVel = (GetRandomControl() & 0x7F) - 256;
spark->rotAng = GetRandomControl() & 0xFFF;
spark->scalar = 3;
spark->maxYvel = 0;
spark->rotAdd = (GetRandomControl() & 0x1F) - 16;
spark->gravity = -spark->yVel >> 2;
spark->sSize = spark->size = ((GetRandomControl() & 3) + 16) * 4;
spark->dSize = 2 * spark->size;
spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 17;
}
}
static void GetBoatGetOff(ITEM_INFO* boat)
void GetBoatGetOff(ITEM_INFO* boat)
{
/* Wait for last frame of getoff anims before returning to normal Lara control */
if ((LaraItem->currentAnimState == BOAT_JUMPR || LaraItem->currentAnimState == BOAT_JUMPL) && LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd)
@ -169,7 +193,7 @@ static void GetBoatGetOff(ITEM_INFO* boat)
}
}
static int CanGetOff(int direction)
bool CanGetOff(int direction)
{
ITEM_INFO* v;
FLOOR_INFO* floor;

View file

@ -4,4 +4,7 @@
void InitialiseBoat(short itemNum);
void BoatCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll);
void BoatControl(short itemNumber);
void BoatControl(short itemNumber);
void DoBoatWakeEffect(ITEM_INFO* boat);
void GetBoatGetOff(ITEM_INFO* boat);
bool CanGetOff(int direction);

File diff suppressed because it is too large Load diff

View file

@ -2,20 +2,35 @@
#include "items.h"
#include "collide.h"
typedef struct SKIDOO_INFO
struct SKIDOO_INFO
{
short track_mesh;
int skidoo_turn;
int left_fallspeed, right_fallspeed;
short momentum_angle, extra_rotation;
short trackMesh;
int skidooTurn;
int leftFallspeed;
int rightFallspeed;
short momentumAngle;
short extraRotation;
int pitch;
bool already_cd_played;
bool alreadyCdPlayed;
bool armed;
int flash_timer;
int flashTimer;
};
void InitialiseSkidoo(short itemNum);
void SkidooCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll);
int SkidooControl(void);
bool SkidooControl();
void DrawSkidoo(ITEM_INFO* item);
void DoSnowEffect(ITEM_INFO* skidoo);
void DoSnowEffect(ITEM_INFO* skidoo);
void SkidooGuns();
void SkidooBaddieCollision(ITEM_INFO* skidoo);
void SkidooExplode(ITEM_INFO* skidoo);
bool SkidooCheckGetOffOK(int direction);
bool SkidooCheckGetOff();
void SkidooAnimation(ITEM_INFO* skidoo, int collide, bool dead);
int GetSkidooCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved);
bool SkidooUserControl(ITEM_INFO* skidoo, int height, int* pitch);
int DoSkidooDynamics(int height, int fallspeed, int* y);
int SkidooCheckGetOn(short itemNum, COLL_INFO* coll);
int TestSkidooHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos);
short DoSkidooShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old);
int SkidooDynamics(ITEM_INFO* skidoo);