11#pragma once
22
3- #include " GameObjectDefs.h"
4-
53// most of game constants is mapped to GTA files format so don't change
64
75// side length of block cube, do not change
2422#define SPRITE_ZERO_ANGLE 90 .0f // all sprites in game are rotated at 90 degrees
2523#define MAP_SPRITE_SCALE (METERS_PER_MAP_UNIT / PIXELS_PER_MAP_UNIT)
2624#define PED_SPRITE_DRAW_BOX_SIZE_PX 24 // with, height
27- #define CAR_WHEEL_SIZE_W_PX 6
28- #define CAR_WHEEL_SIZE_H_PX 12
25+ #define CAR_WHEEL_SIZE_W_PX 6
26+ #define CAR_WHEEL_SIZE_H_PX 12
2927
30- #define GTA_CYCLES_PER_FRAME 24
28+ #define GTA_CYCLES_PER_FRAME 24
3129
3230// in original gta1 map height levels is counting from top to bottom -
3331// 0 is highest and 5 is lowest level
6260
6361#define CAR_DELTA_ANIMS_SPEED 10 .0f
6462
65- // define generic gameobject information
66- struct GameObjectStyle
63+ // forwards
64+ class GameObject ;
65+ class Pedestrian ;
66+ class Vehicle ;
67+ class Projectile ;
68+ class Decoration ;
69+ class Obstacle ;
70+ class Explosion ;
71+
72+ // some game objects has null identifier, they are dacals, projectiles and short-lived effects
73+ #define GAMEOBJECT_ID_NULL 0
74+
75+ using GameObjectID = unsigned int ; // unique id of gameobject instance in world
76+
77+ // gameobject class identifiers
78+ enum eGameObjectClass
79+ {
80+ eGameObjectClass_Car,
81+ eGameObjectClass_Pedestrian,
82+ eGameObjectClass_Projectile,
83+ eGameObjectClass_Powerup,
84+ eGameObjectClass_Decoration,
85+ eGameObjectClass_Obstacle,
86+ eGameObjectClass_Explosion,
87+ eGameObjectClass_COUNT,
88+ };
89+
90+ decl_enum_strings (eGameObjectClass);
91+
92+ enum eGameObjectFlags: unsigned short
93+ {
94+ eGameObjectFlags_None = 0 ,
95+ eGameObjectFlags_Invisible = BIT (0 ),
96+ eGameObjectFlags_CarObject = BIT (1 ),
97+ };
98+
99+ decl_enum_as_flags (eGameObjectFlags);
100+
101+ // game object type indices
102+ enum
103+ {
104+ GameObjectType_Null = 0 ,
105+
106+ GameObjectType_FirstBlood = 63 ,
107+ GameObjectType_Body = 64 ,
108+ // todo...
109+ GameObjectType_MissileProjectile = 31 ,
110+ GameObjectType_BulletProjectile = 74 ,
111+ GameObjectType_FireballProjectile = 75 ,
112+
113+ // todo...
114+ GameObjectType_MAX = 102
115+ };
116+
117+ // define gameobject type information
118+ struct GameObjectInfo
67119{
68120 eGameObjectClass mClassID = eGameObjectClass_COUNT;
69121 eGameObjectFlags mFlags = eGameObjectFlags_None;
70122
71- int mGameObjectIndex = 0 ; // index within loaded styles
123+ // index in the gameobject types table that are loaded with the style data
124+ int mObjectType = GameObjectType_Null;
72125
73126 // width, height and depth store the dimensions of the object with respect to collision checking
74127 // specified in meters
@@ -374,7 +427,7 @@ struct HLSRemap
374427};
375428
376429// define map block information
377- struct BlockStyle
430+ struct MapBlockInfo
378431{
379432 unsigned char mRemap ;
380433
@@ -408,10 +461,10 @@ struct BlockStyle
408461 bool mIsRailway : 1 ;
409462};
410463
411- const unsigned int Sizeof_BlockStyle = sizeof (BlockStyle );
464+ const unsigned int Sizeof_BlockInfo = sizeof (MapBlockInfo );
412465
413466// define map block anim information
414- struct BlockAnimationStyle
467+ struct BlockAnimationInfo
415468{
416469 int mBlock = 0 ; // the block number
417470 int mWhich = 0 ; // the area type ( 0 for side, 1 for lid )
@@ -421,7 +474,7 @@ struct BlockAnimationStyle
421474};
422475
423476// define car door information
424- struct CarDoorStyle
477+ struct CarDoorInfo
425478{
426479 short mRpx , mRpy ;
427480 short mObject ;
@@ -525,11 +578,12 @@ enum eCarConvertible
525578};
526579decl_enum_strings (eCarConvertible);
527580
528- // define car class information
529- struct CarStyle
581+ // define vehicle type information
582+ struct VehicleInfo
530583{
531- short mWidth , mHeight , mDepth ; // dimensions of the car with respect to collision checking, x, y, z
532- short mSprNum ; // first sprite number offset for this car
584+ glm::vec3 mDimensions ; // dimensions of the car with respect to collision checking, meters
585+
586+ int mSpriteIndex ;
533587
534588 struct // specs, usage is unknown
535589 {
@@ -572,12 +626,12 @@ struct CarStyle
572626 int mHorn ;
573627 int mSoundFunction ;
574628 int mFastChangeFlag ;
575- short mDoorsCount ;
576- CarDoorStyle mDoors [MAX_CAR_DOORS];
629+ int mDoorsCount ;
630+ CarDoorInfo mDoors [MAX_CAR_DOORS];
577631};
578632
579633// define sprite information
580- struct SpriteStyle
634+ struct SpriteInfo
581635{
582636 int mWidth ;
583637 int mHeight ;
0 commit comments