more union/enum use

a few more fixes


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1084 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-06-09 04:30:03 +00:00
parent 4a3f0aa335
commit d2f4a6a213
7 changed files with 141 additions and 158 deletions

View File

@ -554,7 +554,7 @@ void() PutClientInServer =
self.max_health = 100;
self.flags = FL_CLIENT;
self.air_finished = time + 12;
self.dmg = 2; // initial water damage
self.waterdmg = 2; // initial water damage
self.super_damage_finished = 0;
self.radsuit_finished = 0;
self.invisible_finished = 0;
@ -857,8 +857,6 @@ WaterMove
============
*/
.float dmgtime;
void() WaterMove =
{
//dprint (ftos(self.waterlevel));
@ -874,16 +872,16 @@ void() WaterMove =
else if (self.air_finished < time + 9)
sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
self.air_finished = time + 12;
self.dmg = 2;
self.waterdmg = 2;
}
else if (self.air_finished < time)
{ // drown!
if (self.pain_finished < time)
{
self.dmg = self.dmg + 2;
if (self.dmg > 15)
self.dmg = 10;
T_Damage (self, world, world, self.dmg, MOD_DROWN);
self.waterdmg = self.waterdmg + 2;
if (self.waterdmg > 15)
self.waterdmg = 10;
T_Damage (self, world, world, self.waterdmg, MOD_DROWN);
self.pain_finished = time + 1;
}
}

View File

@ -175,11 +175,13 @@ void(entity targ, entity inflictor, entity attacker, float damage, INTEGER mod)
damage_mod = mod;
// check for quad damage powerup on the attacker
if (attacker.super_damage_finished > time && inflictor.classname != "door")
if (deathmatch == 4)
damage = damage * 8;
else
damage = damage * 4;
if (attacker.super_damage_finished > time && mod != MOD_SQUISH)
{
if (deathmatch == 4)
damage = damage * 8;
else
damage = damage * 4;
}
// save damage based on the target's armor level

View File

@ -169,8 +169,6 @@ void end_sys_globals; // flag for structure dumping
.float nextthink;
.entity groundentity;
// stats
.float health;
.float frags;
@ -354,11 +352,6 @@ float CONTENT_SLIME = -4;
float CONTENT_LAVA = -5;
float CONTENT_SKY = -6;
float STATE_TOP = 0;
float STATE_BOTTOM = 1;
float STATE_UP = 2;
float STATE_DOWN = 3;
vector VEC_ORIGIN = '0 0 0';
vector VEC_HULL_MIN = '-16 -16 -24';
vector VEC_HULL_MAX = '16 16 32';
@ -378,7 +371,6 @@ float SVC_SMALLKICK = 34;
float SVC_BIGKICK = 35;
float SVC_MUZZLEFLASH = 39;
float TE_SPIKE = 0;
float TE_SUPERSPIKE = 1;
float TE_GUNSHOT = 2;
@ -461,7 +453,6 @@ entity damage_attacker; // set by T_Damage
entity damage_inflictor; // set by T_Damage
INTEGER damage_mod; // set by T_Damage
float framecount;
//
@ -486,117 +477,61 @@ float spotspawn;
//================================================
//
// world fields (FIXME: make globals)
//
.string wad;
.string map;
.float worldtype; // 0=medieval 1=metal 2=base
#define WT_MEDIEVAL 0
#define WT_METAL 1
#define WT_BASE 2
//================================================
.string killtarget;
//
// quakeed fields
//
.float light_lev; // not used by game, but parsed by light util
.float style;
.string killtarget; // used by anything using SUB_UseTargets (items/triggers/etc)
//
// monster ai
//
.void(entity attacker, float damage) th_pain;
.void() th_die;
.void() th_stand;
.void(entity attacker, float damage) th_pain; // used by secret doors, monsters, players
.void() th_die; // used by anything damagable (doors/buttons/players/monsters/explobox/triggermultiple)
.void() th_stand; // used by monsters
// Stuff used by monsters
/*
.void() th_walk;
.void() th_run;
.void() th_missile;
.void() th_melee;
/*
.entity oldenemy;
.float search_time;
.float attack_state;
float AS_STRAIGHT = 1;
float AS_SLIDING = 2;
float AS_MELEE = 3;
float AS_MISSILE = 4;
enum
{
AS_NONE,
AS_STRAIGHT,
AS_SLIDING,
AS_MELEE,
AS_MISSILE
};
*/
.float speed;
//
// player only fields
//
.float walkframe;
.float speed; // used with door/plats/fireball spawner, inherited
.string map; // used with world/trigger_changelevel, inherited
// Zoid Additions
.float maxspeed; // Used to set Maxspeed on a player
.float gravity; // Gravity Multiplier (0 to 1.0)
.float attack_finished;
.float pain_finished;
.float attack_finished; // used with lots of stuff...
.float pain_finished; // used with monsters/players
.float invincible_finished;
.float invisible_finished;
.float super_damage_finished;
.float radsuit_finished;
.float invincible_finished; // only used for players but object check needed for T_Damage
.float super_damage_finished; // only used for players but object check needed for T_Damage
.float invincible_time, invincible_sound;
.float invisible_time, invisible_sound;
.float super_time, super_sound;
.float rad_time;
.float jump_flag; // player jump flag
.float swim_flag; // player swimming sound flag
.float air_finished; // when time > air_finished, start drowning
//
// object stuff
//
.vector mangle; // angle at start
//
// doors, etc
//
.vector dest, dest1, dest2;
.entity trigger_field; // door's trigger entity
.string noise4;
//
// doors
//
.float dmg; // damage done by door when hit
//
// misc
//
.float cnt; // misc flag
.float cnt; // misc flag used by trains/dropped pent and quad
//
// plats / doors / buttons
//
.float lip;
.float state;
.vector pos1, pos2; // top and bottom positions
.float height;
//
// sounds
//
// heal stuff
#define H_ROTTEN 1
#define H_MEGA 2
// intermission
float intermission_running;
float intermission_exittime;
@ -605,6 +540,24 @@ float intermission_exittime;
entity newmis;
#endif
// extensions
.float alpha; // DP_ENT_ALPHA
// enums
// door/plat states
enum {
STATE_TOP,
STATE_BOTTOM,
STATE_UP,
STATE_DOWN
};
// heal defines
enumflags {
H_ROTTEN,
H_MEGA
};
// weaponstate defines
enum {
WS_IDLE,
@ -615,31 +568,62 @@ enum {
// unions
// DO NOT MIX UNION TYPES LIKE I AM DOING
.union {
struct { // fields used with world object
string wad;
float worldtype; // world type, 0=medieval 1=metal 2=base
};
struct { // fields used with triggers/doors/plats
float delay; // time from activation to firing
float wait; // time from firing to restarting
float t_length; // override length to move sideways
float t_width; // override length to move upwards/downwards
void() think1; // used with SUB_CalcMove
vector finaldest; // used with SUB_CalcMove
vector finalangle;// used with SUB_CalcMove
float count; // for counting triggers
float delay; // time from activation to firing
float wait; // time from firing to restarting
float t_length; // override length to move sideways
float t_width; // override length to move upwards/downwards
void() think1; // used with SUB_CalcMove
vector finaldest; // used with SUB_CalcMove
vector finalangle; // used with SUB_CalcMove
float count; // for counting triggers
float dmg; // damage done by door/train/trigger hurt
vector mangle; // initial angle (doors/teleporter/intermission)
float lip; // position adjustment (func_door/func_button)
float state; // object state (doors/buttons/plats)
vector pos1; // top position (doors/buttons/plats)
vector pos2; // bottom position (doors/buttons/plats)
float height; // height (plats/trigger_monsterjump)
string noise4; // extra sound (doors)
entity trigger_field; // used with linking (doors)
vector dest1; // passed to CalcMove (doors)
vector dest2; // passed to CalcMove (doors)
};
struct { // fields used with players
float weaponframe_time; // weapon frame advance time
INTEGER weaponstate; // firing state of current weapon
float suicide_time; // time to allow suicide after spawn
float healdecay; // time when health will decay
float show_hostile; // used to alert monsters
float lightning_sound; // used for lightning sound playback
float fly_sound; // used with trigger_push and maintaining wind sound
float weaponframe_time; // weapon frame advance time
INTEGER weaponstate; // firing state of current weapon
float suicide_time; // time to allow suicide after spawn
float healdecay; // time when health will decay
float show_hostile; // used to alert monsters
float lightning_sound; // used for lightning sound playback
float fly_sound; // used with trigger_push and maintaining wind sound
float invincible_time; // pentagram state
float invincible_sound; // pentagram sound playback
float invisible_time; // ring state
float invisible_sound; // ring sound playback
float invisible_finished; // ring current duration
float super_time; // quad state
float super_sound; // quad sound playback
float rad_time; // rad suit state
float radsuit_finished; // rad suit current duration
float dmgtime; // time slime/lava will damage
float swim_flag; // swim sound playback
float air_finished; // when time > air_finished, start drowning
float waterdmg; // damage water will deal when drowning
float walkframe; // used with walking animation
float jump_flag; // last z velocity used for falling damage
};
struct { // fields used with bubbles spawned from drowning
INTEGER bubble_count; // keeps track of the number of bubbles
INTEGER bubble_state; // associated with bubble progression
};
struct { // fields used with items
float healamount; // amount healed with health item
float healtype; // type of health with health item
INTEGER healtype; // type of health with health item
string mdl; // model used with SUB_regen
float ammo_count; // ammo amount
};
@ -656,10 +640,14 @@ enum {
float expire_time; // time when projectile dies
void() proj_think; // extra think function used with projectile
float proj_think_time; // interval between thinks
INTEGER proj_effect; // effect used with projectile
INTEGER proj_effect; // effect used with projectile
INTEGER voided; // projectile has been voided
float() proj_touch; // extra touch function used with projectile
};
struct { // fields used with lights
float light_lev; // not used by game, but parsed by light util
float style; // lightstyle to use for light
};
// fields used with ambient sounds?
/*
struct {

View File

@ -1179,7 +1179,7 @@ void() item_sigil =
precache_sound ("misc/runekey.wav");
self.noise = "misc/runekey.wav";
switch (self.spawnflags)
switch (self.spawnflags & 15)
{
case 1:
precache_model ("progs/end1.mdl");

View File

@ -102,6 +102,7 @@ void() light_globe =
{
precache_model ("progs/s_light.spr");
setmodel (self, "progs/s_light.spr");
self.alpha = 0.5;
makestatic (self);
};
@ -133,6 +134,7 @@ void() light_flame_large_yellow =
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
self.frame = 1;
self.alpha = 0.5;
FireAmbient ();
makestatic (self);
};
@ -144,6 +146,7 @@ void() light_flame_small_yellow =
{
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
self.alpha = 0.5;
FireAmbient ();
makestatic (self);
};
@ -155,6 +158,7 @@ void() light_flame_small_white =
{
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
self.alpha = 0.5;
FireAmbient ();
makestatic (self);
};
@ -166,8 +170,22 @@ void() light_flame_small_white =
Lava Balls
*/
void() fire_fly;
void() fire_touch;
void() fire_fly =
{
local vector vel;
vel_x = (random() * 100) - 50;
vel_y = (random() * 100) - 50;
vel_z = self.speed + (random() * 200);
PRJ_FireProjectile (world, "progs/lavaball.mdl", self.origin, vel, PE_NONE, 20, MOD_FIREBALL, 5);
newmis.movetype = MOVETYPE_BOUNCE;
newmis.alpha = 0.9;
self.nextthink = time + (random() * 5) + 3;
self.think = fire_fly;
};
void() misc_fireball =
{
@ -179,36 +197,6 @@ void() misc_fireball =
self.speed = 1000;
};
void() fire_fly =
{
local entity fireball;
fireball = spawn();
fireball.solid = SOLID_TRIGGER;
fireball.movetype = MOVETYPE_TOSS;
fireball.velocity = '0 0 1000';
fireball.velocity_x = (random() * 100) - 50;
fireball.velocity_y = (random() * 100) - 50;
fireball.velocity_z = self.speed + (random() * 200);
fireball.classname = "fireball";
setmodel (fireball, "progs/lavaball.mdl");
setsize (fireball, '0 0 0', '0 0 0');
setorigin (fireball, self.origin);
fireball.nextthink = time + 5;
fireball.think = SUB_Remove;
fireball.touch = fire_touch;
self.nextthink = time + (random() * 5) + 3;
self.think = fire_fly;
};
void() fire_touch =
{
T_Damage (other, world, world, 20, MOD_FIREBALL);
remove(self);
};
//============================================================================
@ -306,6 +294,7 @@ void() spikeshooter_use =
MOD_LASER,
5);
newmis.effects |= EF_DIMLIGHT;
newmis.alpha = 0.5;
}
else
{
@ -418,7 +407,8 @@ local entity bubble;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
bubble.bubble_state = 0;
bubble.alpha = 0.4;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random() + 0.5;
self.think = make_bubbles;
@ -438,10 +428,10 @@ local entity bubble;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 1;
bubble.cnt = 10;
bubble.bubble_state = 10;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.frame = 1;
self.cnt = 10;
self.bubble_state = 10;
if (self.waterlevel != 3)
remove (self);
};
@ -460,10 +450,10 @@ void() bubble_bob =
{
local float rnd1, rnd2, rnd3;
self.cnt = self.cnt + 1;
if (self.cnt == 4)
self.bubble_state = self.bubble_state + 1;
if (self.bubble_state == 4)
bubble_split();
if (self.cnt == 20)
if (self.bubble_state == 20)
remove(self);
rnd1 = self.velocity_x + (-10 + (random() * 20));

View File

@ -317,8 +317,8 @@ local entity bubble;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + 0.1;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
self.bubble_count = self.bubble_count - 1;
if (self.bubble_count <= 0)
remove(self);
};
@ -332,7 +332,6 @@ local entity bubble_spawner;
bubble_spawner.solid = SOLID_NOT;
bubble_spawner.nextthink = time + 0.1;
bubble_spawner.think = DeathBubblesSpawn;
bubble_spawner.air_finished = 0;
bubble_spawner.owner = self;
bubble_spawner.bubble_count = num_bubbles;
};

View File

@ -619,6 +619,12 @@ Walking monsters that touch this will jump in the direction of the trigger's ang
*/
void() trigger_monsterjump =
{
if (deathmatch)
{
remove(self);
return;
}
if (!self.speed)
self.speed = 200;
if (!self.height)