Use enum for object types, powerup types, weapon types

This commit is contained in:
zicodxx 2012-09-02 00:23:38 +02:00
parent fcc578c1a8
commit 0df40b1e77
6 changed files with 76 additions and 80 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
main/vers_id.h: Fixed incorrect patch merge introduced in the last commit
main/fireball.c, main/laser.c: Removed Assert in create_smart_children() which has been taken from D2X code but does not apply for D1X and only will let the Assert fail
main/laser.c, main/laser.h, main/object.c, main/object.h, main/powerup.h: Use enum for object types, powerup types, weapon types
20120728
--------

View file

@ -1355,7 +1355,7 @@ void create_smart_children(object *objp)
blob_id = PLAYER_SMART_HOMING_ID;
Assert(blob_id != -1); // Hmm, missing data in bitmaps.tbl. Need "children=NN" parameter.
} else {
blob_id = ROBOT_SMART_HOMING_ID;
blob_id = ((N_weapon_types<ROBOT_SMART_HOMING_ID)?(PLAYER_SMART_HOMING_ID):(ROBOT_SMART_HOMING_ID)); // NOTE: Shareware & reg 1.0 do not have their own Smart structure for bots. It was introduced in 1.4 to make Smart blobs from lvl 7 boss easier to dodge. So if we do not have this type, revert to player's Smart behaviour..,
}
for (i=0; i<NUM_SMART_CHILDREN; i++) {

View file

@ -20,23 +20,27 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifndef _LASER_H
#define _LASER_H
#define CONCUSSION_ID 8
#define FLARE_ID 9 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
#define LASER_ID 10
#define VULCAN_ID 11 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
#define XSPREADFIRE_ID 12 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
#define PLASMA_ID 13 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
#define FUSION_ID 14 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
#define HOMING_ID 15
#define PROXIMITY_ID 16
#define SMART_ID 17
#define MEGA_ID 18
#define PLAYER_SMART_HOMING_ID 19
#define SPREADFIRE_ID 20
#define SUPER_MECH_MISS 21
#define REGULAR_MECH_MISS 22
#define SILENT_SPREADFIRE_ID 23
#define ROBOT_SMART_HOMING_ID ((N_weapon_types<29)?(PLAYER_SMART_HOMING_ID):(29)) // NOTE: Shareware does not have it's own Smart structure for bots. It was introduced later to make Smart blobs from lvl 7 boss easier to dodge. So if we do not have this type, revert to player's Smart behaviour..
enum weapon_type_t
{
CONCUSSION_ID = 8,
FLARE_ID = 9, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
LASER_ID = 10,
VULCAN_ID = 11, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
XSPREADFIRE_ID = 12, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
PLASMA_ID = 13, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
FUSION_ID = 14, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
HOMING_ID = 15,
PROXIMITY_ID = 16,
SMART_ID = 17,
MEGA_ID = 18,
PLAYER_SMART_HOMING_ID = 19,
SPREADFIRE_ID = 20,
SUPER_MECH_MISS = 21,
REGULAR_MECH_MISS = 22,
SILENT_SPREADFIRE_ID = 23,
ROBOT_SMART_HOMING_ID = 29, // NOTE: check create_smart_children()!!!
};
// These are new defines for the value of 'flags' passed to do_laser_firing.
// The purpose is to collect other flags like QUAD_LASER and Spreadfire_toggle

View file

@ -1096,7 +1096,7 @@ void free_object_slots(int num_used)
//note that segnum is really just a suggestion, since this routine actually
//searches for the correct segment
//returns the object number
int obj_create(ubyte type,ubyte id,int segnum,vms_vector *pos,
int obj_create(enum object_type_t type, ubyte id,int segnum,vms_vector *pos,
vms_matrix *orient,fix size,ubyte ctype,ubyte mtype,ubyte rtype)
{
int objnum;

View file

@ -37,22 +37,26 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define MAX_USED_OBJECTS (MAX_OBJECTS-20)
// Object types
#define OBJ_NONE 255 // unused object
#define OBJ_WALL 0 // A wall... not really an object, but used for collisions
#define OBJ_FIREBALL 1 // a fireball, part of an explosion
#define OBJ_ROBOT 2 // an evil enemy
#define OBJ_HOSTAGE 3 // a hostage you need to rescue
#define OBJ_PLAYER 4 // the player on the console
#define OBJ_WEAPON 5 // a laser, missile, etc
#define OBJ_CAMERA 6 // a camera to slew around with
#define OBJ_POWERUP 7 // a powerup you can pick up
#define OBJ_DEBRIS 8 // a piece of robot
#define OBJ_CNTRLCEN 9 // the control center
#define OBJ_FLARE 10 // a flare
#define OBJ_CLUTTER 11 // misc objects
#define OBJ_GHOST 12 // what the player turns into when dead
#define OBJ_LIGHT 13 // a light source, & not much else
#define OBJ_COOP 14 // a cooperative player object.
enum object_type_t
{
OBJ_NONE = 255, // unused object
OBJ_WALL = 0, // A wall... not really an object, but used for collisions
OBJ_FIREBALL = 1, // a fireball, part of an explosion
OBJ_ROBOT = 2, // an evil enemy
OBJ_HOSTAGE = 3, // a hostage you need to rescue
OBJ_PLAYER = 4, // the player on the console
OBJ_WEAPON = 5, // a laser, missile, etc
OBJ_CAMERA = 6, // a camera to slew around with
OBJ_POWERUP = 7, // a powerup you can pick up
OBJ_DEBRIS = 8, // a piece of robot
OBJ_CNTRLCEN = 9, // the control center
OBJ_FLARE = 10, // a flare
OBJ_CLUTTER = 11, // misc objects
OBJ_GHOST = 12, // what the player turns into when dead
OBJ_LIGHT = 13, // a light source, & not much else
OBJ_COOP = 14, // a cooperative player object.
};
// WARNING!! If you add a type here, add its name to Object_type_names
// in object.c
#define MAX_OBJECT_TYPES 15
@ -395,7 +399,7 @@ void obj_unlink(int objnum);
// initialize a new object. adds to the list for the given segment
// returns the object number
int obj_create(ubyte type, ubyte id, int segnum, vms_vector *pos,
int obj_create(enum object_type_t type, ubyte id, int segnum, vms_vector *pos,
vms_matrix *orient, fix size,
ubyte ctype, ubyte mtype, ubyte rtype);

View file

@ -23,55 +23,42 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "vclip.h"
#include "player.h"
#define POW_EXTRA_LIFE 0
#define POW_ENERGY 1
#define POW_SHIELD_BOOST 2
#define POW_LASER 3
enum powerup_type_t
{
POW_EXTRA_LIFE = 0,
POW_ENERGY = 1,
POW_SHIELD_BOOST = 2,
POW_LASER = 3,
#define POW_KEY_BLUE 4
#define POW_KEY_RED 5
#define POW_KEY_GOLD 6
POW_KEY_BLUE = 4,
POW_KEY_RED = 5,
POW_KEY_GOLD = 6,
#define POW_RADAR_ROBOTS 7
#define POW_RADAR_POWERUPS 8
#define POW_FULL_MAP 9
POW_RADAR_ROBOTS = 7,
POW_RADAR_POWERUPS = 8,
POW_FULL_MAP = 9,
#define POW_MISSILE_1 10
#define POW_MISSILE_4 11
POW_MISSILE_1 = 10,
POW_MISSILE_4 = 11, // 4-pack MUST follow single missile
#define POW_QUAD_FIRE 12
POW_QUAD_FIRE = 12,
//--#define POW_VULCAN_WEAPON 13
//--#define POW_SPREADFIRE_WEAPON 14
//--#define POW_PLASMA_WEAPON 15
//--#define POW_FUSION_WEAPON 16
//--#define POW_PROXIMITY_WEAPON 17
//--#define POW_SMARTBOMB_WEAPON 18
//--#define POW_MEGA_WEAPON 19
//--#define POW_VULCAN_AMMO 20
//--#define POW_HOMING_AMMO_1 21
//--#define POW_HOMING_AMMO_4 22
//--#define POW_CLOAK 23
//--#define POW_TURBO 24
//--#define POW_INVULNERABILITY 25
//--#define POW_HEADLIGHT 26
//--#define POW_MEGAWOW 27
#define POW_VULCAN_WEAPON 13
#define POW_SPREADFIRE_WEAPON 14
#define POW_PLASMA_WEAPON 15
#define POW_FUSION_WEAPON 16
#define POW_PROXIMITY_WEAPON 17
#define POW_HOMING_AMMO_1 18 //21
#define POW_HOMING_AMMO_4 19 //22
#define POW_SMARTBOMB_WEAPON 20 //18
#define POW_MEGA_WEAPON 21 //19
#define POW_VULCAN_AMMO 22 //20
#define POW_CLOAK 23
#define POW_TURBO 24
#define POW_INVULNERABILITY 25
#define POW_HEADLIGHT 26
#define POW_MEGAWOW 27
POW_VULCAN_WEAPON = 13,
POW_SPREADFIRE_WEAPON = 14,
POW_PLASMA_WEAPON = 15,
POW_FUSION_WEAPON = 16,
POW_PROXIMITY_WEAPON = 17,
POW_HOMING_AMMO_1 = 18,
POW_HOMING_AMMO_4 = 19,
POW_SMARTBOMB_WEAPON = 20,
POW_MEGA_WEAPON = 21,
POW_VULCAN_AMMO = 22,
POW_CLOAK = 23,
POW_TURBO = 24,
POW_INVULNERABILITY = 25,
POW_HEADLIGHT = 26,
POW_MEGAWOW = 27,
};
#define VULCAN_AMMO_MAX (392*2)
#define VULCAN_WEAPON_AMMO_AMOUNT 196