Made the boolean type consistently int or float, without using conversions.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3053 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-11-09 23:29:13 +00:00
parent c6aca04939
commit 0b792a6355
17 changed files with 115 additions and 59 deletions

View file

@ -158,7 +158,7 @@ visible
returns 1 if the entity is visible to self, even if not infront ()
=============
*/
float (entity targ) visible =
BOOL (entity targ) visible =
{
local vector spot1, spot2;
@ -182,7 +182,7 @@ infront
returns 1 if the entity is in front (in sight) of self
=============
*/
float(entity targ) infront =
BOOL(entity targ) infront =
{
local vector vec;
local float dot;
@ -350,7 +350,7 @@ checked each frame. This means multi player games will have slightly
slower noticing monsters.
============
*/
float() FindTarget =
BOOL() FindTarget =
{
local entity client;
local float r;
@ -570,7 +570,7 @@ FacingIdeal
============
*/
float() FacingIdeal =
BOOL() FacingIdeal =
{
local float delta;
@ -582,11 +582,11 @@ float() FacingIdeal =
//=============================================================================
float(float enemy_range) DogCheckAttack;
float(float enemy_range) WizardCheckAttack;
float(float enemy_range) DemonCheckAttack;
BOOL(float enemy_range) DogCheckAttack;
BOOL(float enemy_range) WizardCheckAttack;
BOOL(float enemy_range) DemonCheckAttack;
float(float enemy_range) CheckAnyAttack =
BOOL(float enemy_range) CheckAnyAttack =
{
switch (self.classname)
@ -748,3 +748,4 @@ void(float dist) ai_run =
movetogoal (dist); // done in C code...
};

View file

@ -1280,7 +1280,7 @@ ClientObituary
called when a player dies
============
*/
float(entity targ, entity attacker) OnSameTeam;
BOOL(entity targ, entity attacker) OnSameTeam;
void(entity targ, entity attacker, INTEGER mod) ClientObituary =
{
@ -1319,3 +1319,4 @@ void(entity targ, entity attacker, INTEGER mod) ClientObituary =
}
};

Binary file not shown.

View file

@ -1,7 +1,3 @@
#define FALSE 0
#define TRUE 1
#ifdef FTE
// use real int if using FTE type progs
#define INTEGER int
@ -9,6 +5,12 @@
#define INTEGER float
#endif
#define BOOL INTEGER
#define FALSE ((BOOL)0)
#define TRUE ((BOOL)1)
/*
==============================================================================
@ -425,7 +427,6 @@ float EF_FLAG2 = 32;
// float movedist;
string string_null; // null string, nothing should be held here
float empty_float;
entity activator; // the entity that activated a trigger or brush
@ -480,8 +481,8 @@ entity shub; // boss entity
.INTEGER ammo_cells_real; // real cells count
// Zoid Additions
.float maxspeed; // Used to set Maxspeed on a player
.float gravity; // Gravity Multiplier (0 to 1.0)
noref .float maxspeed; // Used to set Maxspeed on a player
noref .float gravity; // Gravity Multiplier (0 to 1.0)
.float attack_finished; // used with lots of stuff...
.float pain_finished; // used with monsters/players
@ -556,10 +557,9 @@ enum {
};
// unions
// DO NOT MIX UNION TYPES LIKE I AM DOING
//floats (includes vectors)
.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
@ -567,7 +567,6 @@ enum {
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
@ -578,14 +577,11 @@ enum {
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
@ -604,32 +600,18 @@ enum {
float swim_flag; // swim sound playback
float air_finished; // when time > air_finished, start drowning
float waterdmg; // damage water will deal when drowning
INTEGER walkframe; // used with walking animation
float jump_flag; // last z velocity used for falling damage
INTEGER ammo_type; // ammo type in use
};
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
INTEGER healtype; // type of health with health item
string mdl; // model used with SUB_regen
float ammo_count; // ammo amount
};
struct { // fields used with generic projectiles
float damage_direct; // damage done with a direct hit
float damage_exp; // damage done from radius damage
float radius_exp; // radius of radius damage
INTEGER mod_direct; // mod type for direct hit
INTEGER mod_exp; // mod type for radius damage
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 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
@ -638,13 +620,6 @@ enum {
struct { // fields used with monsters
float search_time; // search time intervals
float attack_state; // current AI attack state
void() th_stand; // standing animation
void() th_walk; // walking animation
void() th_run; // running animation
void() th_missile; // ranged animation
void() th_melee; // melee animation
entity oldenemy; // old enemy
entity movetarget; // target entity to move to
float pausetime; // time to pause for monsters
float hknightattack; // hell knight attack pattern
float lefty; // ai slide move
@ -662,6 +637,77 @@ enum {
*/
};
//integers
.union {
struct { // fields used with players
INTEGER weaponstate; // firing state of current weapon
INTEGER walkframe; // used with walking animation
INTEGER ammo_type; // ammo type in use
};
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
INTEGER healtype; // type of health with health item
};
struct { // fields used with generic projectiles
INTEGER mod_direct; // mod type for direct hit
INTEGER mod_exp; // mod type for radius damage
INTEGER proj_effect; // effect used with projectile
INTEGER voided; // projectile has been voided
};
};
//functions
.union {
struct { // fields used with triggers/doors/plats
void() think1; // used with SUB_CalcMove
};
struct { // fields used with generic projectiles
void() proj_think; // extra think function used with projectile
float() proj_touch; // extra touch function used with projectile
};
struct { // fields used with monsters
void() th_stand; // standing animation
void() th_walk; // walking animation
void() th_run; // running animation
void() th_missile; // ranged animation
void() th_melee; // melee animation
};
};
//entities
.union {
struct { // fields used with triggers/doors/plats
entity trigger_field; // used with linking (doors)
};
struct { // fields used with monsters
entity oldenemy; // old enemy
entity movetarget; // target entity to move to
};
};
//strings
.union {
struct { // fields used with world object
string wad; //mute it
};
struct { // fields used with triggers/doors/plats
string noise4; // extra sound (doors)
};
struct { // fields used with items
string mdl; // model used with SUB_regen
};
};
//mute those warnings (unions/structs do not support noref mid-struct, but a later def will propogate the noref flag)
noref .string wad;
noref .float light_lev;
//===========================================================================
@ -789,5 +835,6 @@ void(entity targ, entity inflictor, entity attacker, float damage, INTEGER mod)
float (entity e, float healamount, float ignore) T_Heal; // health function
float(entity targ, entity inflictor) CanDamage;
BOOL(entity targ, entity inflictor) CanDamage;

View file

@ -230,7 +230,7 @@ CheckDemonMelee
Returns TRUE if a melee attack would hit right now
==============
*/
float(float enemy_range) CheckDemonMelee =
BOOL(float enemy_range) CheckDemonMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
@ -246,7 +246,7 @@ CheckDemonJump
==============
*/
float() CheckDemonJump =
BOOL() CheckDemonJump =
{
local vector dist;
local float d;
@ -276,7 +276,7 @@ float() CheckDemonJump =
return TRUE;
};
float(float enemy_range) DemonCheckAttack =
BOOL(float enemy_range) DemonCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDemonMelee (enemy_range))
@ -354,3 +354,4 @@ void() Demon_JumpTouch =
self.nextthink = time + 0.1;
};

View file

@ -253,7 +253,7 @@ CheckDogMelee
Returns TRUE if a melee attack would hit right now
==============
*/
float(float enemy_range) CheckDogMelee =
BOOL(float enemy_range) CheckDogMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
@ -269,7 +269,7 @@ CheckDogJump
==============
*/
float() CheckDogJump =
BOOL() CheckDogJump =
{
local vector dist;
local float d;
@ -296,7 +296,7 @@ float() CheckDogJump =
return TRUE;
};
float(float enemy_range) DogCheckAttack =
BOOL(float enemy_range) DogCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDogMelee (enemy_range))
@ -354,3 +354,4 @@ void() monster_dog =
walkmonster_start();
};

View file

@ -287,7 +287,7 @@ entity(vector fmins, vector fmaxs) spawn_field =
};
float (entity e1, entity e2) EntitiesTouching =
BOOL (entity e1, entity e2) EntitiesTouching =
{
if (e1.mins_x > e2.maxs_x)
return FALSE;
@ -767,4 +767,4 @@ void () func_door_secret =
self.oldorigin = self.origin;
if (!self.wait)
self.wait = 5; // 5 seconds before closing
};
};

View file

@ -291,4 +291,4 @@ void(float damage) spawn_touchblood =
vel = vel + 2*trace_plane_normal;
vel = vel * 0.4;
SpawnBlood (self.origin + vel, damage);
};
};

Binary file not shown.

Binary file not shown.

View file

@ -1566,3 +1566,4 @@ void() DropBackpack =
};

View file

@ -382,7 +382,7 @@ void() bubble_bob;
testing air bubbles
*/
var void() air_bubbles = SUB_Remove;
noref var void() air_bubbles = SUB_Remove;
void() make_bubbles =
{
@ -471,7 +471,7 @@ local float rnd1, rnd2, rnd3;
Just for the debugging level. Don't use
*/
var void() viewthing = SUB_Remove;
noref var void() viewthing = SUB_Remove;
/*
==============================================================================
@ -609,3 +609,4 @@ void() ambient_swamp2 =
precache_sound ("ambience/swamp2.wav");
ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
};

View file

@ -405,3 +405,4 @@ void() monster_ogre_marksman =
};

View file

@ -65,4 +65,4 @@
#ifdef REPLACEMENTS
#include "replace.qc"
#endif
#endif

Binary file not shown.

View file

@ -548,7 +548,7 @@ PLAYER WEAPON USE
===============================================================================
*/
// different from W_CheckNoAmmo due to SSG/SNG being able to fire 1 shot instead of 2...
float(float wep) W_HasAmmo =
BOOL(float wep) W_HasAmmo =
{
switch (wep)
{
@ -673,7 +673,7 @@ float() W_BestWeapon =
}
};
float() W_CheckNoAmmo =
BOOL() W_CheckNoAmmo =
{
if (self.currentammo > 0)
return TRUE;
@ -1222,3 +1222,4 @@ void() testfunction =
return;
};
*/

View file

@ -43,7 +43,7 @@ void() wiz_side1;
WizardCheckAttack
=================
*/
float(float enemy_range) WizardCheckAttack =
BOOL(float enemy_range) WizardCheckAttack =
{
local vector spot1, spot2;
local entity targ;
@ -317,3 +317,4 @@ void() monster_wizard =
flymonster_start ();
};