mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 18:32:42 +01:00
- bomberman refactoring update
This commit is contained in:
parent
7d3a4083e6
commit
b7f7363f79
@ -23,8 +23,9 @@
|
||||
#include "RAND.H"
|
||||
|
||||
MODEL* gBombModel;
|
||||
_ExOBJECT explosion[5];
|
||||
static BOMB ThrownBombs[5];
|
||||
|
||||
static BOMB ThrownBombs[MAX_THROWN_BOMBS];
|
||||
|
||||
static int ThrownBombDelay = 0;
|
||||
static int CurrentBomb = 0;
|
||||
static int gWantFlash = 0;
|
||||
@ -71,7 +72,7 @@ void InitThrownBombs(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < MAX_THROWN_BOMBS; i++)
|
||||
ThrownBombs[i].flags = 0;
|
||||
|
||||
ThrownBombDelay = Random2(0) % 45 + 8;
|
||||
@ -153,7 +154,7 @@ void HandleThrownBombs(void)
|
||||
ThrownBombDelay = Random2(0) % 45 + 8;
|
||||
|
||||
bomb = &ThrownBombs[CurrentBomb++];
|
||||
CurrentBomb = CurrentBomb % 5;
|
||||
CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS;
|
||||
|
||||
bomb->flags = 1;
|
||||
bomb->active = 1;
|
||||
@ -182,7 +183,7 @@ void HandleThrownBombs(void)
|
||||
bomb = ThrownBombs;
|
||||
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
while (i < MAX_THROWN_BOMBS)
|
||||
{
|
||||
if ((bomb->flags & 1) != 0)
|
||||
{
|
||||
@ -303,7 +304,7 @@ void DrawThrownBombs(void)
|
||||
|
||||
bomb = ThrownBombs;
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
while (i < MAX_THROWN_BOMBS)
|
||||
{
|
||||
if ((bomb->flags & 1) != 0)
|
||||
{
|
||||
@ -406,7 +407,7 @@ void BombThePlayerToHellAndBack(int car)
|
||||
gBombTargetVehicle = &car_data[(car + 1) % maxCivCars];
|
||||
|
||||
bomb = &ThrownBombs[CurrentBomb++];
|
||||
CurrentBomb = CurrentBomb % 5;
|
||||
CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS;
|
||||
|
||||
bomb->flags = 1;
|
||||
bomb->active = 1;
|
||||
@ -420,7 +421,7 @@ void BombThePlayerToHellAndBack(int car)
|
||||
bomb->velocity.vz = 0;
|
||||
|
||||
bomb = &ThrownBombs[CurrentBomb++];
|
||||
CurrentBomb = CurrentBomb % 5;
|
||||
CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS;
|
||||
|
||||
bomb->flags = 1;
|
||||
bomb->active = 1;
|
||||
@ -434,7 +435,7 @@ void BombThePlayerToHellAndBack(int car)
|
||||
bomb->velocity.vz = 0;
|
||||
|
||||
bomb = &ThrownBombs[CurrentBomb++];
|
||||
CurrentBomb = CurrentBomb % 5;
|
||||
CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS;
|
||||
|
||||
bomb->flags = 1;
|
||||
bomb->active = 1;
|
||||
@ -769,13 +770,13 @@ void ExplosionCollisionCheck(_CAR_DATA *cp, _ExOBJECT *pE)
|
||||
pointVel[1] = denom * (collisionResult.surfNormal.vy >> 6);
|
||||
pointVel[2] = denom * (collisionResult.surfNormal.vz >> 6);
|
||||
|
||||
cp->st.n.linearVelocity[0] = cp->st.n.linearVelocity[0] + pointVel[0];
|
||||
cp->st.n.linearVelocity[1] = cp->st.n.linearVelocity[1] + pointVel[1];
|
||||
cp->st.n.linearVelocity[2] = cp->st.n.linearVelocity[2] + pointVel[2];
|
||||
cp->st.n.linearVelocity[0] += pointVel[0];
|
||||
cp->st.n.linearVelocity[1] += pointVel[1];
|
||||
cp->st.n.linearVelocity[2] += pointVel[2];
|
||||
|
||||
cp->hd.aacc[0] = (cp->hd.aacc[0] + FIXEDH(lever[1] * pointVel[2])) - FIXEDH(lever[2] * pointVel[1]);
|
||||
cp->hd.aacc[1] = (cp->hd.aacc[1] + FIXEDH(lever[2] * pointVel[0])) - FIXEDH(lever[0] * pointVel[2]);
|
||||
cp->hd.aacc[2] = (cp->hd.aacc[2] + FIXEDH(lever[0] * pointVel[1])) - FIXEDH(lever[1] * pointVel[0]);
|
||||
cp->hd.aacc[0] += FIXEDH(lever[1] * pointVel[2]) - FIXEDH(lever[2] * pointVel[1]);
|
||||
cp->hd.aacc[1] += FIXEDH(lever[2] * pointVel[0]) - FIXEDH(lever[0] * pointVel[2]);
|
||||
cp->hd.aacc[2] += FIXEDH(lever[0] * pointVel[1]) - FIXEDH(lever[1] * pointVel[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define BOMBERMAN_H
|
||||
|
||||
extern MODEL* gBombModel;
|
||||
extern _ExOBJECT explosion[5];
|
||||
extern _CAR_DATA *gBombTargetVehicle;
|
||||
|
||||
extern void InitThrownBombs(); // 0x0001F570
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include "INLINE_C.H"
|
||||
|
||||
_ExOBJECT explosion[MAX_EXPLOSION_OBJECTS];
|
||||
|
||||
MATRIX SS = { 0 };
|
||||
|
||||
// decompiled code
|
||||
@ -54,7 +56,7 @@ void InitExObjects(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < MAX_EXPLOSION_OBJECTS; i++)
|
||||
explosion[i].time = -1;
|
||||
|
||||
initExplosion();
|
||||
@ -186,7 +188,7 @@ void HandleExplosion(void)
|
||||
i = 0;
|
||||
exp = explosion;
|
||||
|
||||
while (i < 5)
|
||||
while (i < MAX_EXPLOSION_OBJECTS)
|
||||
{
|
||||
if (exp->time != -1 && exp->type != BANG_USED)
|
||||
{
|
||||
@ -207,7 +209,7 @@ void HandleExplosion(void)
|
||||
|
||||
i = 0;
|
||||
exp = explosion;
|
||||
while (i < 5)
|
||||
while (i < MAX_EXPLOSION_OBJECTS)
|
||||
{
|
||||
if (exp->time != -1)
|
||||
{
|
||||
@ -277,7 +279,7 @@ void DrawAllExplosions(void)
|
||||
{
|
||||
int i;
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
while (i < MAX_EXPLOSION_OBJECTS)
|
||||
{
|
||||
if (explosion[i].time != -1)
|
||||
DrawExplosion(explosion[i].time, explosion[i].pos, explosion[i].hscale, explosion[i].rscale);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef JOB_FX_H
|
||||
#define JOB_FX_H
|
||||
|
||||
extern _ExOBJECT explosion[MAX_EXPLOSION_OBJECTS];
|
||||
|
||||
extern void InitExObjects(); // 0x00057B0C
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "DR2ROADS.H"
|
||||
#include "MOTION_C.H"
|
||||
#include "CONVERT.H"
|
||||
#include "GAMESND.H"
|
||||
#include "SOUND.H"
|
||||
#include "PAD.H"
|
||||
#include "CIV_AI.H"
|
||||
@ -19,7 +18,7 @@
|
||||
#include "AI.H"
|
||||
#include "CARS.H"
|
||||
#include "FELONY.H"
|
||||
#include "BOMBERMAN.H"
|
||||
#include "JOB_FX.H"
|
||||
#include "BCOLLIDE.H"
|
||||
#include "MAP.H"
|
||||
#include "SYSTEM.H"
|
||||
|
@ -4,9 +4,11 @@
|
||||
// DRIVER 2 game engine limits
|
||||
// please populate this file only with engine limits during refactoring
|
||||
|
||||
#define MAX_CARS 20
|
||||
#define MAX_CAR_MODELS 5
|
||||
#define MAX_PEDESTRIANS 28
|
||||
#define MAX_TRAFFIC_CARS 19
|
||||
#define MAX_CARS 20
|
||||
#define MAX_CAR_MODELS 5
|
||||
#define MAX_PEDESTRIANS 28
|
||||
#define MAX_TRAFFIC_CARS 19
|
||||
#define MAX_EXPLOSION_OBJECTS 5
|
||||
#define MAX_THROWN_BOMBS 5
|
||||
|
||||
#endif // DRLIMITS_H
|
Loading…
Reference in New Issue
Block a user