Refactored m_actor.c in default Lazarus and missionpack DLLs with macros for weapon numbers.

Reformatted g_camera.c in default Lazarus and missionpack DLLs.
Added color string utility function to missionpack DLL.
This commit is contained in:
Knightmare66 2021-11-05 05:23:57 -04:00
parent 054d9522ec
commit 6de038bb2b
11 changed files with 353 additions and 222 deletions

View file

@ -33,13 +33,13 @@ void camera_off (edict_t *ent)
return;
if (!ent->client->spycam)
return;
if(ent->client->spycam->viewer == ent)
if (ent->client->spycam->viewer == ent)
ent->client->spycam->viewer = NULL;
ent->client->spycam->flags &= ~FL_ROBOT;
if(ent->client->spycam->svflags & SVF_MONSTER)
if (ent->client->spycam->svflags & SVF_MONSTER)
ent->client->spycam->svflags &= ~SVF_NOCLIENT;
VectorCopy(ent->client->camplayer->s.origin,ent->s.origin);
VectorCopy (ent->client->camplayer->s.origin, ent->s.origin);
gi.TagFree(ent->client->camplayer->client);
G_FreeEdict (ent->client->camplayer);
@ -49,10 +49,10 @@ void camera_off (edict_t *ent)
for (i=0 ; i<3 ; i++)
ent->client->ps.pmove.delta_angles[i] =
ANGLE2SHORT(ent->client->org_viewangles[i] - ent->client->resp.cmd_angles[i]);
VectorCopy(ent->client->org_viewangles, ent->client->resp.cmd_angles);
VectorCopy(ent->client->org_viewangles, ent->s.angles);
VectorCopy(ent->client->org_viewangles, ent->client->ps.viewangles);
VectorCopy(ent->client->org_viewangles, ent->client->v_angle);
VectorCopy (ent->client->org_viewangles, ent->client->resp.cmd_angles);
VectorCopy (ent->client->org_viewangles, ent->s.angles);
VectorCopy (ent->client->org_viewangles, ent->client->ps.viewangles);
VectorCopy (ent->client->org_viewangles, ent->client->v_angle);
ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
@ -82,14 +82,14 @@ void camera_off (edict_t *ent)
void faker_animate(edict_t *self)
{
if(self->s.frame < 0 || self->s.frame > 39)
if (self->s.frame < 0 || self->s.frame > 39)
{
self->s.frame = 0;
}
else
{
self->s.frame++;
if(self->s.frame > 39)
if (self->s.frame > 39)
self->s.frame = 0;
}
self->nextthink = level.time + FRAMETIME;
@ -119,7 +119,7 @@ void camera_on (edict_t *ent)
camera->viewer = ent;
// save current viewangles and restore them with camera_off
VectorCopy(ent->client->v_angle,ent->client->org_viewangles);
VectorCopy (ent->client->v_angle, ent->client->org_viewangles);
// copy over all important player data to fake player
ent->client->camplayer = G_Spawn();
@ -143,20 +143,20 @@ void camera_on (edict_t *ent)
faker->light_level = ent->light_level;
faker->think = faker_animate;
faker->nextthink = level.time + FRAMETIME;
VectorCopy(ent->mins,faker->mins);
VectorCopy(ent->maxs,faker->maxs);
VectorCopy (ent->mins, faker->mins);
VectorCopy (ent->maxs, faker->maxs);
// create a client so you can pick up items/be shot/etc while in camera
cl = (gclient_t *) gi.TagMalloc(sizeof(gclient_t), TAG_LEVEL);
memset(cl,0,sizeof(gclient_t));
memset (cl, 0, sizeof(gclient_t));
ent->client->camplayer->client = cl;
ent->client->camplayer->target_ent = ent;
gi.linkentity (faker);
AngleVectors(camera->s.angles,forward,left,up);
AngleVectors (camera->s.angles, forward, left, up);
VectorMA(camera->s.origin, camera->move_origin[0],forward,ent->s.origin);
VectorMA(ent->s.origin, -camera->move_origin[1],left, ent->s.origin);
VectorMA(ent->s.origin, camera->move_origin[2],up, ent->s.origin);
VectorMA (camera->s.origin, camera->move_origin[0], forward, ent->s.origin);
VectorMA (ent->s.origin, -camera->move_origin[1], left, ent->s.origin);
VectorMA (ent->s.origin, camera->move_origin[2], up, ent->s.origin);
ent->movetype = MOVETYPE_NOCLIP;
ent->clipmask = 0;
@ -186,7 +186,7 @@ void camera_on (edict_t *ent)
}
if (ent->client->spycam->viewmessage)
safe_centerprintf(ent,ent->client->spycam->viewmessage);
safe_centerprintf (ent, ent->client->spycam->viewmessage);
}
@ -194,10 +194,10 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
{
edict_t *next;
if(!monitor->target) return NULL;
if (!monitor->target) return NULL;
// If we already have a camera that's a monster, make it visible now
if(camera && (camera->svflags & SVF_MONSTER))
if (camera && (camera->svflags & SVF_MONSTER))
{
camera->svflags &= ~SVF_NOCLIENT;
gi.linkentity(camera);
@ -207,14 +207,15 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
// or just scan through the list of entities. If count for the first camera
// in the map is 0, then we'll just use the map order.
next = G_Find(NULL,FOFS(targetname),monitor->target);
if(!next) return NULL;
if(!next->count) {
if(camera) {
next = G_Find(NULL, FOFS(targetname), monitor->target);
if (!next) return NULL;
if (!next->count)
{
if (camera) {
next = camera;
next++;
} else
}
else
next = g_edicts;
for ( ; next < &g_edicts[globals.num_edicts] ; next++)
@ -228,9 +229,9 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
if (!next->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16))
if ( !Q_stricmp (next->classname, "turret_breach") && (next->spawnflags & 16) )
continue;
if (!Q_stricmp (next->targetname, monitor->target))
if ( !Q_stricmp (next->targetname, monitor->target) )
goto found_one;
}
@ -246,43 +247,50 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
if (!next->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16))
if ( !Q_stricmp (next->classname, "turret_breach") && (next->spawnflags & 16) )
continue;
if (!Q_stricmp (next->targetname, monitor->target))
if ( !Q_stricmp (next->targetname, monitor->target ))
goto found_one;
}
} else {
}
else
{
int which, start;
if(camera) {
if (camera) {
which = camera->count+1;
if(which > monitor->count) which = 1;
if (which > monitor->count) which = 1;
}
else
which = 1;
start = which;
next = g_edicts+1;
while(1) {
if(next->targetname) {
if(!Q_stricmp(next->targetname,monitor->target)) {
if(next->count == which) {
if(!next->inuse || (next->deadflag == DEAD_DEAD) ||
(!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16)) )
while (1)
{
if (next->targetname)
{
if ( !Q_stricmp(next->targetname, monitor->target) )
{
if (next->count == which)
{
if (!next->inuse || (next->deadflag == DEAD_DEAD) ||
( !Q_stricmp (next->classname, "turret_breach") && (next->spawnflags & 16) ) )
{
next = g_edicts;
which++;
if(which > monitor->count) which=1;
if(which == start) return NULL;
} else
if (which > monitor->count) which = 1;
if (which == start) return NULL;
}
else
goto found_one;
}
}
}
if(next == &g_edicts[globals.num_edicts-1]) {
if (next == &g_edicts[globals.num_edicts-1]) {
next = g_edicts;
which++;
if(which > monitor->count) which = 1;
if(which == start) return NULL;
if (which > monitor->count) which = 1;
if (which == start) return NULL;
}
next++;
}
@ -290,7 +298,7 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
return NULL;
found_one:
if(!(monitor->spawnflags & 32) && (next->svflags & SVF_MONSTER))
if (!(monitor->spawnflags & 32) && (next->svflags & SVF_MONSTER))
next->svflags |= SVF_NOCLIENT;
return next;
}
@ -300,10 +308,10 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
edict_t *prev;
edict_t *newcamera;
if(!monitor->target) return NULL;
if (!monitor->target) return NULL;
// If we already have a camera that's a monster, make it visible now
if(camera && (camera->svflags & SVF_MONSTER))
if (camera && (camera->svflags & SVF_MONSTER))
{
camera->svflags &= ~SVF_NOCLIENT;
gi.linkentity(camera);
@ -313,9 +321,9 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
// or just scan through the list of entities. If count for the first camera
// in the map is 0, then we'll just use the map order.
prev = G_Find(NULL,FOFS(targetname),monitor->target);
if(!prev) return NULL;
if(!prev->count)
prev = G_Find(NULL, FOFS(targetname), monitor->target);
if (!prev) return NULL;
if (!prev->count)
{
newcamera = NULL;
for (prev = g_edicts ; prev < &g_edicts[globals.num_edicts] ; prev++)
@ -331,9 +339,9 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
if (!prev->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (prev->classname,"turret_breach") && (prev->spawnflags & 16))
if ( !Q_stricmp (prev->classname, "turret_breach") && (prev->spawnflags & 16) )
continue;
if (!Q_stricmp (prev->targetname, monitor->target))
if ( !Q_stricmp (prev->targetname, monitor->target) )
newcamera = prev;
}
goto found_one;
@ -342,39 +350,42 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
{
int which, start;
if(camera) {
if (camera) {
which = camera->count-1;
if(which <= 0) which = monitor->count;
if (which <= 0) which = monitor->count;
}
else
which = monitor->count;
start = which;
prev = g_edicts+1;
while(1) {
if(prev->targetname) {
if(!Q_stricmp(prev->targetname,monitor->target)) {
if(prev->count == which) {
if(!prev->inuse || (prev->deadflag == DEAD_DEAD) ||
(!Q_stricmp (prev->classname,"turret_breach") && (prev->spawnflags & 16)))
while (1)
{
if (prev->targetname)
{
if ( !Q_stricmp(prev->targetname, monitor->target) )
{
if (prev->count == which)
{
if (!prev->inuse || (prev->deadflag == DEAD_DEAD) ||
( !Q_stricmp (prev->classname, "turret_breach") && (prev->spawnflags & 16)) )
{
prev = g_edicts;
which--;
if(which <= 0) which=monitor->count;
if(which == start) return NULL;
if (which <= 0) which = monitor->count;
if (which == start) return NULL;
}
else
{
else {
newcamera = prev;
goto found_one;
}
}
}
}
if(prev == &g_edicts[globals.num_edicts-1]) {
if (prev == &g_edicts[globals.num_edicts-1]) {
prev = g_edicts;
which--;
if(which <= 0) which=monitor->count;
if(which == start) return NULL;
if (which <= 0) which=monitor->count;
if (which == start) return NULL;
}
prev++;
}
@ -392,15 +403,15 @@ void use_camera (edict_t *self, edict_t *other, edict_t *activator)
{
edict_t *target;
if(!activator->client) return;
if(activator->client->spycam) // already using camera
if (!activator->client) return;
if (activator->client->spycam) // already using camera
return;
target = G_FindNextCamera(NULL,self);
if(!target) return;
target = G_FindNextCamera(NULL, self);
if (!target) return;
// if currently in thirdperson, turn that sucker off
if(tpp->value && activator->client->chasetoggle)
if (tpp->value && activator->client->chasetoggle)
Cmd_Chasecam_Toggle (activator);
#ifdef KMQUAKE2_ENGINE_MOD
@ -423,16 +434,16 @@ void func_monitor_init (edict_t *self)
self->count = 0;
camera = NULL;
while( (camera=G_Find(camera,FOFS(targetname),self->target)) != NULL)
while ( (camera = G_Find(camera, FOFS(targetname), self->target)) != NULL)
self->count++;
if(!self->count)
if (!self->count)
self->s.effects = 0; // don't animate a func_monitor that has no cameras
}
void SP_func_monitor (edict_t *self)
{
if( !self->target ) {
gi.dprintf("func_monitor without a target at %s\n",vtos(self->s.origin));
if ( !self->target ) {
gi.dprintf("func_monitor without a target at %s\n", vtos(self->s.origin));
G_FreeEdict(self);
return;
}

View file

@ -3751,7 +3751,7 @@ void target_failure_player_die (edict_t *player)
player->client->zoomed = false;
SetSensitivities(player,true);
if (player->client->spycam)
camera_off(player);
camera_off (player);
VectorClear (player->avelocity);
player->takedamage = DAMAGE_NO;
player->movetype = MOVETYPE_NONE;

View file

@ -29,6 +29,20 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "m_actor.h"
#include "pak.h"
#define ACTOR_WEAP_BLASTER 1
#define ACTOR_WEAP_SHOTGUN 2
#define ACTOR_WEAP_SSHOTGUN 3
#define ACTOR_WEAP_MACHINEGUN 4
#define ACTOR_WEAP_CHAINGUN 5
#define ACTOR_WEAP_GLAUNCHER 6
#define ACTOR_WEAP_RLAUCHER 7
#define ACTOR_WEAP_HYPERBLASTER 8
#define ACTOR_WEAP_RAILGUN 9
#define ACTOR_WEAP_BFG 10
#define ACTOR_WEAP_FIRST 1
#define ACTOR_WEAP_LAST 10
static char wavname[NUM_ACTOR_SOUNDS][32] =
{ "jump1.wav",
"pain25_1.wav",
@ -489,33 +503,33 @@ void actor_ideal_range(edict_t *self)
switch (weapon)
{
case 2:
case ACTOR_WEAP_SHOTGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 270;
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 90;
break;
case 4:
case 5:
case ACTOR_WEAP_MACHINEGUN:
case ACTOR_WEAP_CHAINGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 450;
break;
case 6:
case ACTOR_WEAP_GLAUNCHER:
self->monsterinfo.ideal_range[0] = 200;
self->monsterinfo.ideal_range[1] = 450;
break;
case 7:
case ACTOR_WEAP_RLAUCHER:
self->monsterinfo.ideal_range[0] = 300;
self->monsterinfo.ideal_range[1] = 1000;
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
self->monsterinfo.ideal_range[0] = 200;
self->monsterinfo.ideal_range[1] = 500;
break;
case 9:
case 10:
case ACTOR_WEAP_RAILGUN:
case ACTOR_WEAP_BFG:
self->monsterinfo.ideal_range[0] = 300;
self->monsterinfo.ideal_range[1] = 1000;
break;
@ -698,16 +712,16 @@ void actor_fire (edict_t *self)
switch (weapon)
{
case 1:
case ACTOR_WEAP_BLASTER:
actorBlaster (self);
break;
case 2:
case ACTOR_WEAP_SHOTGUN:
actorShotgun (self);
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
actorSuperShotgun (self);
break;
case 4:
case ACTOR_WEAP_MACHINEGUN:
actorMachineGun (self);
if (level.time >= self->monsterinfo.pausetime)
// self->monsterinfo.aiflags &= ~(AI_HOLD_FRAME|AI_STAND_GROUND);
@ -716,30 +730,30 @@ void actor_fire (edict_t *self)
// self->monsterinfo.aiflags |= (AI_HOLD_FRAME|AI_STAND_GROUND);
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 5:
case ACTOR_WEAP_CHAINGUN:
actorChaingun (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 6:
case ACTOR_WEAP_GLAUNCHER:
actorGrenadeLauncher (self);
break;
case 7:
case ACTOR_WEAP_RLAUCHER:
actorRocket (self);
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
actorHyperblaster (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 9:
case ACTOR_WEAP_RAILGUN:
actorRailGun (self);
break;
case 10:
case ACTOR_WEAP_BFG:
actorBFG (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
@ -944,30 +958,30 @@ void actor_attack (edict_t *self)
switch (weapon)
{
case 1:
case ACTOR_WEAP_BLASTER:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 2 * FRAMETIME;
break;
case 2:
case ACTOR_WEAP_SHOTGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 6 * FRAMETIME;
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
break;
case 4:
case ACTOR_WEAP_MACHINEGUN:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 15) + 3 + 7;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 5:
case ACTOR_WEAP_CHAINGUN:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 20) + 20;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 6:
case 7:
case ACTOR_WEAP_GLAUNCHER:
case ACTOR_WEAP_RLAUCHER:
self->monsterinfo.currentmove = attackmove;
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
{ // if hes just standing there refire rate is normal
@ -978,16 +992,16 @@ void actor_attack (edict_t *self)
self->monsterinfo.pausetime = level.time + 2;
}
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 15) + 3 + 7;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 9:
case ACTOR_WEAP_RAILGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 3;
break;
case 10:
case ACTOR_WEAP_BFG:
if (level.time > self->endtime)
{
self->monsterinfo.currentmove = attackmove;
@ -1052,7 +1066,7 @@ qboolean actor_checkattack (edict_t *self)
weapon = self->actor_weapon[self->actor_current_weapon];
// If actor has no weapon, well then of course he should not attack
if (weapon < 1 || weapon > 10)
if ( (weapon < ACTOR_WEAP_FIRST) || (weapon > ACTOR_WEAP_LAST) )
return false;
if (self->enemy->health > 0)
@ -1361,7 +1375,7 @@ void SP_misc_actor (edict_t *self)
self->actor_weapon[0] = 0;
self->actor_weapon[1] = -self->sounds;
}
else if (self->sounds <= 10)
else if (self->sounds <= ACTOR_WEAP_LAST) // was 10
{
self->actor_weapon[0] = self->sounds;
self->actor_weapon[1] = 0;
@ -1392,6 +1406,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 41, 4, 19); break;
case 9: VectorSet (self->muzzle, 40, 4, 19); break;
case 10: VectorSet (self->muzzle, 42, 5, 20); break;
default: VectorSet (self->muzzle, 40, 4, 19); break;
}
break;
case ACTOR_PARANOID:
@ -1407,6 +1422,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 18, 7, 14); break;
case 9: VectorSet (self->muzzle, 28, 7, 10); break;
case 10: VectorSet (self->muzzle, 28, 7, 10); break;
default: VectorSet (self->muzzle, 28, 7, 10); break;
}
break;
case ACTOR_RATAMAHATTA:
@ -1431,6 +1447,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 12, 6, -1); break;
case 9: VectorSet (self->muzzle, 32, 7, 10); break;
case 10: VectorSet (self->muzzle, 20, 5, -1); break;
default: VectorSet (self->muzzle, 32, 7, 10); break;
}
break;
case ACTOR_TERRAN:
@ -1452,6 +1469,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 26, 7.5, 8); break;
case 9: VectorSet (self->muzzle, 26, 9, 7); break;
case 10: VectorSet (self->muzzle, 22, 11, 7); break;
default: VectorSet (self->muzzle, 26, 9, 7); break;
}
break;
case ACTOR_XENOID:
@ -1470,6 +1488,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 20, 3, 2); break;
case 9: VectorSet (self->muzzle, 26, 2, 9); break;
case 10: VectorSet (self->muzzle, 16, 5, -2); break;
default: VectorSet (self->muzzle, 26, 2, 9); break;
}
break;
default:
@ -2014,16 +2033,16 @@ void actor_files (void)
Com_sprintf (filename, sizeof(filename), "players/%s/",e->usermodel);
switch (e->actor_weapon[k])
{
case 2: Q_strncatz (filename, sizeof(filename), "w_shotgun.md2"); break;
case 3: Q_strncatz (filename, sizeof(filename), "w_sshotgun.md2"); break;
case 4: Q_strncatz (filename, sizeof(filename), "w_machinegun.md2"); break;
case 5: Q_strncatz (filename, sizeof(filename), "w_chaingun.md2"); break;
case 6: Q_strncatz (filename, sizeof(filename), "w_glauncher.md2"); break;
case 7: Q_strncatz (filename, sizeof(filename), "w_rlauncher.md2"); break;
case 8: Q_strncatz (filename, sizeof(filename), "w_hyperblaster.md2"); break;
case 9: Q_strncatz (filename, sizeof(filename), "w_railgun.md2"); break;
case 10: Q_strncatz (filename, sizeof(filename), "w_bfg.md2"); break;
default: Q_strncatz (filename, sizeof(filename), "w_blaster.md2"); break;
case ACTOR_WEAP_SHOTGUN: Q_strncatz (filename, sizeof(filename), "w_shotgun.md2"); break;
case ACTOR_WEAP_SSHOTGUN: Q_strncatz (filename, sizeof(filename), "w_sshotgun.md2"); break;
case ACTOR_WEAP_MACHINEGUN: Q_strncatz (filename, sizeof(filename), "w_machinegun.md2"); break;
case ACTOR_WEAP_CHAINGUN: Q_strncatz (filename, sizeof(filename), "w_chaingun.md2"); break;
case ACTOR_WEAP_GLAUNCHER: Q_strncatz (filename, sizeof(filename), "w_glauncher.md2"); break;
case ACTOR_WEAP_RLAUCHER: Q_strncatz (filename, sizeof(filename), "w_rlauncher.md2"); break;
case ACTOR_WEAP_HYPERBLASTER: Q_strncatz (filename, sizeof(filename), "w_hyperblaster.md2"); break;
case ACTOR_WEAP_RAILGUN: Q_strncatz (filename, sizeof(filename), "w_railgun.md2"); break;
case ACTOR_WEAP_BFG: Q_strncatz (filename, sizeof(filename), "w_bfg.md2"); break;
default: Q_strncatz (filename, sizeof(filename), "w_blaster.md2"); break;
}
if (strlen(gamedir->string))

View file

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//ed - weapon protos
// ed - weapon protos
void actorBlaster (edict_t *self);
void actorShotgun (edict_t *self);
void actorSuperShotgun (edict_t *self);

View file

@ -22,7 +22,7 @@ void camera_off (edict_t *ent)
ent->client->spycam->flags &= ~FL_ROBOT;
if (ent->client->spycam->svflags & SVF_MONSTER)
ent->client->spycam->svflags &= ~SVF_NOCLIENT;
VectorCopy(ent->client->camplayer->s.origin,ent->s.origin);
VectorCopy (ent->client->camplayer->s.origin, ent->s.origin);
gi.TagFree(ent->client->camplayer->client);
G_FreeEdict (ent->client->camplayer);
@ -32,10 +32,10 @@ void camera_off (edict_t *ent)
for (i=0 ; i<3 ; i++)
ent->client->ps.pmove.delta_angles[i] =
ANGLE2SHORT(ent->client->org_viewangles[i] - ent->client->resp.cmd_angles[i]);
VectorCopy(ent->client->org_viewangles, ent->client->resp.cmd_angles);
VectorCopy(ent->client->org_viewangles, ent->s.angles);
VectorCopy(ent->client->org_viewangles, ent->client->ps.viewangles);
VectorCopy(ent->client->org_viewangles, ent->client->v_angle);
VectorCopy (ent->client->org_viewangles, ent->client->resp.cmd_angles);
VectorCopy (ent->client->org_viewangles, ent->s.angles);
VectorCopy (ent->client->org_viewangles, ent->client->ps.viewangles);
VectorCopy (ent->client->org_viewangles, ent->client->v_angle);
ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
@ -106,7 +106,7 @@ void camera_on (edict_t *ent)
camera->viewer = ent;
// save current viewangles and restore them with camera_off
VectorCopy(ent->client->v_angle,ent->client->org_viewangles);
VectorCopy (ent->client->v_angle, ent->client->org_viewangles);
// copy over all important player data to fake player
ent->client->camplayer = G_Spawn();
@ -131,20 +131,20 @@ void camera_on (edict_t *ent)
faker->light_level = ent->light_level;
faker->think = faker_animate;
faker->nextthink = level.time + FRAMETIME;
VectorCopy(ent->mins,faker->mins);
VectorCopy(ent->maxs,faker->maxs);
VectorCopy (ent->mins, faker->mins);
VectorCopy (ent->maxs, faker->maxs);
// create a client so you can pick up items/be shot/etc while in camera
cl = (gclient_t *) gi.TagMalloc(sizeof(gclient_t), TAG_LEVEL);
memset(cl,0,sizeof(gclient_t));
memset (cl, 0, sizeof(gclient_t));
ent->client->camplayer->client = cl;
ent->client->camplayer->target_ent = ent;
gi.linkentity (faker);
AngleVectors(camera->s.angles,forward,left,up);
AngleVectors (camera->s.angles ,forward, left, up);
VectorMA(camera->s.origin, camera->move_origin[0],forward,ent->s.origin);
VectorMA(ent->s.origin, -camera->move_origin[1],left, ent->s.origin);
VectorMA(ent->s.origin, camera->move_origin[2],up, ent->s.origin);
VectorMA (camera->s.origin, camera->move_origin[0], forward, ent->s.origin);
VectorMA (ent->s.origin, -camera->move_origin[1], left, ent->s.origin);
VectorMA (ent->s.origin, camera->move_origin[2], up, ent->s.origin);
ent->movetype = MOVETYPE_NOCLIP;
ent->clipmask = 0;
@ -174,7 +174,7 @@ void camera_on (edict_t *ent)
}
if (ent->client->spycam->viewmessage)
gi.centerprintf(ent,ent->client->spycam->viewmessage);
gi.centerprintf (ent, ent->client->spycam->viewmessage);
}
@ -195,7 +195,7 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
// or just scan through the list of entities. If count for the first camera
// in the map is 0, then we'll just use the map order.
next = G_Find(NULL,FOFS(targetname),monitor->target);
next = G_Find(NULL, FOFS(targetname), monitor->target);
if (!next) return NULL;
if (!next->count)
{
@ -218,9 +218,9 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
if (!next->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16))
if ( !Q_stricmp(next->classname, "turret_breach") && (next->spawnflags & 16) )
continue;
if (!Q_stricmp (next->targetname, monitor->target))
if ( !Q_stricmp(next->targetname, monitor->target) )
goto found_one;
}
@ -236,9 +236,9 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
if (!next->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16))
if ( !Q_stricmp(next->classname, "turret_breach") && (next->spawnflags & 16) )
continue;
if (!Q_stricmp (next->targetname, monitor->target))
if ( !Q_stricmp(next->targetname, monitor->target ))
goto found_one;
}
}
@ -258,11 +258,12 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor)
{
if (next->targetname)
{
if (!Q_stricmp(next->targetname,monitor->target))
if ( !Q_stricmp(next->targetname, monitor->target) )
{
if (next->count == which) {
if (next->count == which)
{
if (!next->inuse || (next->deadflag == DEAD_DEAD) ||
(!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16)) )
( !Q_stricmp (next->classname, "turret_breach") && (next->spawnflags & 16) ) )
{
next = g_edicts;
which++;
@ -308,7 +309,7 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
// or just scan through the list of entities. If count for the first camera
// in the map is 0, then we'll just use the map order.
prev = G_Find(NULL,FOFS(targetname),monitor->target);
prev = G_Find(NULL, FOFS(targetname), monitor->target);
if (!prev) return NULL;
if (!prev->count)
{
@ -326,9 +327,9 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
if (!prev->targetname)
continue;
// don't select "inactive" cameras
if (!Q_stricmp (prev->classname,"turret_breach") && (prev->spawnflags & 16))
if ( !Q_stricmp (prev->classname, "turret_breach") && (prev->spawnflags & 16) )
continue;
if (!Q_stricmp (prev->targetname, monitor->target))
if ( !Q_stricmp (prev->targetname, monitor->target) )
newcamera = prev;
}
goto found_one;
@ -349,12 +350,12 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor)
{
if (prev->targetname)
{
if (!Q_stricmp(prev->targetname,monitor->target))
if ( !Q_stricmp(prev->targetname, monitor->target) )
{
if (prev->count == which)
{
if (!prev->inuse || (prev->deadflag == DEAD_DEAD) ||
(!Q_stricmp (prev->classname,"turret_breach") && (prev->spawnflags & 16)))
if ( !prev->inuse || (prev->deadflag == DEAD_DEAD) ||
( !Q_stricmp (prev->classname, "turret_breach") && (prev->spawnflags & 16) ) )
{
prev = g_edicts;
which--;
@ -395,7 +396,7 @@ void use_camera (edict_t *self, edict_t *other, edict_t *activator)
if (activator->client->spycam) // already using camera
return;
target = G_FindNextCamera(NULL,self);
target = G_FindNextCamera(NULL, self);
if (!target) return;
// if currently in thirdperson, turn that sucker off
@ -425,7 +426,7 @@ void func_monitor_init (edict_t *self)
self->count = 0;
camera = NULL;
while ( (camera=G_Find(camera,FOFS(targetname),self->target)) != NULL)
while ( (camera=G_Find(camera, FOFS(targetname), self->target)) != NULL)
self->count++;
if (!self->count)
self->s.effects = 0; // don't animate a func_monitor that has no cameras
@ -435,7 +436,7 @@ void SP_func_monitor (edict_t *self)
{
if ( !self->target )
{
gi.dprintf("func_monitor without a target at %s\n",vtos(self->s.origin));
gi.dprintf("func_monitor without a target at %s\n", vtos(self->s.origin));
G_FreeEdict(self);
return;
}

View file

@ -1815,8 +1815,6 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
#if defined (KMQUAKE2_ENGINE_MOD) || defined (Q2E_ENGINE_MOD)
if (useColor)
tempevent = TE_RAILTRAIL_COLORED;
// if ( (self->client) && (sk_rail_color->value == 2) )
// tempevent = TE_RAILTRAIL2;
else
#endif
tempevent = TE_RAILTRAIL;

View file

@ -6,6 +6,26 @@
#include "m_actor.h"
#include "pak.h"
#define ACTOR_WEAP_BLASTER 1
#define ACTOR_WEAP_SHOTGUN 2
#define ACTOR_WEAP_SSHOTGUN 3
#define ACTOR_WEAP_MACHINEGUN 4
#define ACTOR_WEAP_CHAINGUN 5
#define ACTOR_WEAP_GLAUNCHER 6
#define ACTOR_WEAP_RLAUCHER 7
#define ACTOR_WEAP_HYPERBLASTER 8
#define ACTOR_WEAP_RAILGUN 9
#define ACTOR_WEAP_BFG 10
#define ACTOR_WEAP_IONRIPPER 11
#define ACTOR_WEAP_PHALANX 12
#define ACTOR_WEAP_ETFRIFLE 13
#define ACTOR_WEAP_PLASMABEAM 14
#define ACTOR_WEAP_DISRUPTOR 15
#define ACTOR_WEAP_PLASMARIFLE 16
#define ACTOR_WEAP_FIRST 1
#define ACTOR_WEAP_LAST 16
static char wavname[NUM_ACTOR_SOUNDS][32] =
{ "jump1.wav",
"pain25_1.wav",
@ -468,54 +488,58 @@ void actor_ideal_range(edict_t *self)
switch (weapon)
{
case 2:
case ACTOR_WEAP_SHOTGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 270;
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 90;
break;
case 4:
case 5:
case ACTOR_WEAP_MACHINEGUN:
case ACTOR_WEAP_CHAINGUN:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 450;
break;
case 6:
case ACTOR_WEAP_GLAUNCHER:
self->monsterinfo.ideal_range[0] = 200;
self->monsterinfo.ideal_range[1] = 450;
break;
case 7:
case ACTOR_WEAP_RLAUCHER:
self->monsterinfo.ideal_range[0] = 300;
self->monsterinfo.ideal_range[1] = 1000;
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
self->monsterinfo.ideal_range[0] = 200;
self->monsterinfo.ideal_range[1] = 500;
break;
case 9:
case 10:
case ACTOR_WEAP_RAILGUN:
case ACTOR_WEAP_BFG:
self->monsterinfo.ideal_range[0] = 300;
self->monsterinfo.ideal_range[1] = 1000;
break;
// Knightmare- added mission pack weapon support
case 11:
case ACTOR_WEAP_IONRIPPER:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 600;
break;
case 12:
case ACTOR_WEAP_PHALANX:
self->monsterinfo.ideal_range[0] = 300;
self->monsterinfo.ideal_range[1] = 1000;
break;
case 13:
self->monsterinfo.ideal_range[0] = 20;
case ACTOR_WEAP_ETFRIFLE:
self->monsterinfo.ideal_range[0] = 100;
self->monsterinfo.ideal_range[1] = 1000;
break;
case 14:
case ACTOR_WEAP_PLASMABEAM:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 1500;
break;
case 15:
case ACTOR_WEAP_DISRUPTOR:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 1000;
break;
case ACTOR_WEAP_PLASMARIFLE:
self->monsterinfo.ideal_range[0] = 0;
self->monsterinfo.ideal_range[1] = 1000;
break;
@ -702,80 +726,80 @@ void actor_fire (edict_t *self)
switch (weapon)
{
case 1:
case ACTOR_WEAP_BLASTER:
actorBlaster (self);
break;
case 2:
case ACTOR_WEAP_SHOTGUN:
actorShotgun (self);
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
actorSuperShotgun (self);
break;
case 4:
case ACTOR_WEAP_MACHINEGUN:
actorMachineGun (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 5:
case ACTOR_WEAP_CHAINGUN:
actorChaingun (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 6:
case ACTOR_WEAP_GLAUNCHER:
actorGrenadeLauncher (self);
break;
case 7:
case ACTOR_WEAP_RLAUCHER:
actorRocket (self);
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
actorHyperblaster(self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 9:
case ACTOR_WEAP_RAILGUN:
actorRailGun (self);
break;
case 10:
case ACTOR_WEAP_BFG:
actorBFG (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 11:
case ACTOR_WEAP_IONRIPPER:
actorIonripper(self);
break;
case 12:
case ACTOR_WEAP_PHALANX:
actorPhalanx (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 13:
case ACTOR_WEAP_ETFRIFLE:
actorETF_Rifle (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 14:
case ACTOR_WEAP_PLASMABEAM:
actorPlasmaBeam (self);
if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break;
case 15:
case ACTOR_WEAP_DISRUPTOR:
actorDisintegrator (self);
break;
case 16:
case ACTOR_WEAP_PLASMARIFLE:
actorPlasmaRifle (self);
break;
}
@ -977,30 +1001,30 @@ void actor_attack (edict_t *self)
switch (weapon)
{
case 1:
case ACTOR_WEAP_BLASTER:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 2 * FRAMETIME;
break;
case 2:
case ACTOR_WEAP_SHOTGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 6 * FRAMETIME;
break;
case 3:
case ACTOR_WEAP_SSHOTGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
break;
case 4:
case ACTOR_WEAP_MACHINEGUN:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 15) + 10;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 5:
case ACTOR_WEAP_CHAINGUN:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 20) + 20;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 6:
case 7:
case ACTOR_WEAP_GLAUNCHER:
case ACTOR_WEAP_RLAUCHER:
self->monsterinfo.currentmove = attackmove;
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
{ // if hes just standing there refire rate is normal
@ -1011,16 +1035,16 @@ void actor_attack (edict_t *self)
self->monsterinfo.pausetime = level.time + 2;
}
break;
case 8:
case ACTOR_WEAP_HYPERBLASTER:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 15) + 3 + 7;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 9:
case ACTOR_WEAP_RAILGUN:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 3;
break;
case 10:
case ACTOR_WEAP_BFG:
if (level.time > self->endtime)
{
self->monsterinfo.currentmove = attackmove;
@ -1029,11 +1053,11 @@ void actor_attack (edict_t *self)
else
self->monsterinfo.currentmove = &actor_move_stand;
break;
case 11:
case ACTOR_WEAP_IONRIPPER:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 6 * FRAMETIME;
break;
case 12:
case ACTOR_WEAP_PHALANX:
self->monsterinfo.currentmove = attackmove;
// self->monsterinfo.pausetime = level.time + 4;
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
@ -1045,23 +1069,23 @@ void actor_attack (edict_t *self)
self->monsterinfo.pausetime = level.time + 2;
}
break;
case 13:
case ACTOR_WEAP_ETFRIFLE:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 11) + 7;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 14:
case ACTOR_WEAP_PLASMABEAM:
self->monsterinfo.currentmove = attackmove;
n = (rand() & 10) + 5;
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
break;
case 15:
case ACTOR_WEAP_DISRUPTOR:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
break;
case 16:
case ACTOR_WEAP_PLASMARIFLE:
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
self->monsterinfo.pausetime = level.time + 20 * FRAMETIME;
break;
}
}
@ -1119,7 +1143,7 @@ qboolean actor_checkattack (edict_t *self)
weapon = self->actor_weapon[self->actor_current_weapon];
// If actor has no weapon, well then of course he should not attack
if (weapon < 1 || weapon > 16) // Knightmare- mission pack weapon support, was > 10
if (weapon < ACTOR_WEAP_FIRST || weapon > ACTOR_WEAP_LAST) // Knightmare- mission pack weapon support, was > 10
return false;
if (self->enemy->health > 0)
@ -1474,7 +1498,7 @@ void SP_misc_actor (edict_t *self)
self->actor_weapon[0] = 0;
self->actor_weapon[1] = -self->sounds;
}
else if (self->sounds <= 16) // Knightmare- added mission pack weapon support, was <= 10
else if (self->sounds <= ACTOR_WEAP_LAST) // Knightmare- added mission pack weapon support, was <= 10
{
self->actor_weapon[0] = self->sounds;
self->actor_weapon[1] = 0;
@ -1505,6 +1529,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 41, 4, 19); break;
case 9: VectorSet (self->muzzle, 40, 4, 19); break;
case 10: VectorSet (self->muzzle, 42, 5, 20); break;
default: VectorSet (self->muzzle, 40, 4, 19); break;
}
break;
case ACTOR_PARANOID:
@ -1520,6 +1545,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 18, 7, 14); break;
case 9: VectorSet (self->muzzle, 28, 7, 10); break;
case 10: VectorSet (self->muzzle, 28, 7, 10); break;
default: VectorSet (self->muzzle, 28, 7, 10); break;
}
break;
case ACTOR_RATAMAHATTA:
@ -1544,6 +1570,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 12, 6, -1); break;
case 9: VectorSet (self->muzzle, 32, 7, 10); break;
case 10: VectorSet (self->muzzle, 20, 5, -1); break;
default: VectorSet (self->muzzle, 32, 7, 10); break;
}
break;
case ACTOR_TERRAN:
@ -1565,6 +1592,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 26, 7.5, 8); break;
case 9: VectorSet (self->muzzle, 26, 9, 7); break;
case 10: VectorSet (self->muzzle, 22, 11, 7); break;
default: VectorSet (self->muzzle, 26, 9, 7); break;
}
break;
case ACTOR_XENOID:
@ -1583,6 +1611,7 @@ void SP_misc_actor (edict_t *self)
case 8: VectorSet (self->muzzle, 20, 3, 2); break;
case 9: VectorSet (self->muzzle, 26, 2, 9); break;
case 10: VectorSet (self->muzzle, 16, 5, -2); break;
default: VectorSet (self->muzzle, 26, 2, 9); break;
}
break;
default:
@ -2135,25 +2164,25 @@ void actor_files (void)
Com_sprintf (filename, sizeof(filename), "players/%s/", e->usermodel);
switch (e->actor_weapon[k])
{
case 2: Com_strcat (filename, sizeof(filename), "w_shotgun.md2"); break;
case 3: Com_strcat (filename, sizeof(filename), "w_sshotgun.md2"); break;
case 4: Com_strcat (filename, sizeof(filename), "w_machinegun.md2"); break;
case 5: Com_strcat (filename, sizeof(filename), "w_chaingun.md2"); break;
case 6: Com_strcat (filename, sizeof(filename), "w_glauncher.md2"); break;
case 7: Com_strcat (filename, sizeof(filename), "w_rlauncher.md2"); break;
case 8: Com_strcat (filename, sizeof(filename), "w_hyperblaster.md2"); break;
case 9: Com_strcat (filename, sizeof(filename), "w_railgun.md2"); break;
case 10: Com_strcat (filename, sizeof(filename), "w_bfg.md2"); break;
case ACTOR_WEAP_SHOTGUN: Com_strcat (filename, sizeof(filename), "w_shotgun.md2"); break;
case ACTOR_WEAP_SSHOTGUN: Com_strcat (filename, sizeof(filename), "w_sshotgun.md2"); break;
case ACTOR_WEAP_MACHINEGUN: Com_strcat (filename, sizeof(filename), "w_machinegun.md2"); break;
case ACTOR_WEAP_CHAINGUN: Com_strcat (filename, sizeof(filename), "w_chaingun.md2"); break;
case ACTOR_WEAP_GLAUNCHER: Com_strcat (filename, sizeof(filename), "w_glauncher.md2"); break;
case ACTOR_WEAP_RLAUCHER: Com_strcat (filename, sizeof(filename), "w_rlauncher.md2"); break;
case ACTOR_WEAP_HYPERBLASTER: Com_strcat (filename, sizeof(filename), "w_hyperblaster.md2"); break;
case ACTOR_WEAP_RAILGUN: Com_strcat (filename, sizeof(filename), "w_railgun.md2"); break;
case ACTOR_WEAP_BFG: Com_strcat (filename, sizeof(filename), "w_bfg.md2"); break;
// Knightmare- mission pack weapon support
case 11: Com_strcat (filename, sizeof(filename), "w_ripper.md2"); break;
case 12: Com_strcat (filename, sizeof(filename), "w_phalanx.md2"); break;
case 13: Com_strcat (filename, sizeof(filename), "w_etfrifle.md2"); break;
case 14: Com_strcat (filename, sizeof(filename), "w_plasma.md2"); break;
case 15: Com_strcat (filename, sizeof(filename), "w_disrupt.md2"); break;
case ACTOR_WEAP_IONRIPPER: Com_strcat (filename, sizeof(filename), "w_ripper.md2"); break;
case ACTOR_WEAP_PHALANX: Com_strcat (filename, sizeof(filename), "w_phalanx.md2"); break;
case ACTOR_WEAP_ETFRIFLE: Com_strcat (filename, sizeof(filename), "w_etfrifle.md2"); break;
case ACTOR_WEAP_PLASMABEAM: Com_strcat (filename, sizeof(filename), "w_plasma.md2"); break;
case ACTOR_WEAP_DISRUPTOR: Com_strcat (filename, sizeof(filename), "w_disrupt.md2"); break;
// LMSP plasma rifle
case 16: Com_strcat (filename, sizeof(filename), "w_plasmarifle.md2"); break;
case ACTOR_WEAP_PLASMARIFLE: Com_strcat (filename, sizeof(filename), "w_plasmarifle.md2"); break;
// end Knightmare
default: Com_strcat (filename, sizeof(filename), "w_blaster.md2"); break;
default: Com_strcat (filename, sizeof(filename), "w_blaster.md2"); break;
}
if (strlen(gamedir->string))

View file

@ -1,5 +1,4 @@
//ed - weapon protos
//ed - weapon protos
// ed - weapon protos
void actorBlaster (edict_t *self);
void actorShotgun (edict_t *self);
void actorSuperShotgun (edict_t *self);

View file

@ -1019,7 +1019,7 @@ void actorDisintegrator (edict_t *self)
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/disint2.wav"), 1, ATTN_NORM, 0);
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 32 : 40;
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 34 : 45;
speed = (int)sk_disruptor_speed->value;
fire_tracker (self, start, forward, damage, speed, self->enemy);

View file

@ -1138,6 +1138,57 @@ skipwhite:
}
/*
=================
Com_ParseHexDigit
Parse an int value from a single hex digit
=================
*/
int Com_ParseHexDigit (const char c)
{
if ( (c >= '0') && (c <= '9') )
return (c - '0');
if ( (c >= 'A') && (c <= 'F') )
return 10 + (c - 'A');
if ( (c >= 'a') && (c <= 'f') )
return 10 + (c - 'a');
return -1;
}
/*
=================
Com_ParseColorString
Parse an RGB color from an rrggbb string
=================
*/
qboolean Com_ParseColorString (const char *s, color_t outColor)
{
int i, digits[6];
// catch null string or too short string
if ( !s || (strlen(s) < 6) ) {
outColor[0] = outColor[1] = outColor[2] = 0;
return false;
}
// parse thru all 6 digits
for (i = 0; i < 6; i++) {
digits[i] = Com_ParseHexDigit(s[i]);
if (digits[i] < 0)
return false;
}
outColor[0] = ((digits[0] & 0xF) << 4) | (digits[1] & 0xF);
outColor[1] = ((digits[2] & 0xF) << 4) | (digits[3] & 0xF);
outColor[2] = ((digits[4] & 0xF) << 4) | (digits[5] & 0xF);
return true;
}
/*
===============
Com_PageInMemory

View file

@ -99,6 +99,9 @@ __inline int Q_vsnprintf (char *Dest, size_t Count, const char *Format, va_list
#define CLIENT_THIRDPERSON_CVAR "cg_thirdperson"
//#define CLIENT_THIRDPERSON_CVAR "cl_3dcam"
#define MAX_CUSTOM_ANIMS 1024 // This sets the size of an mmove_t array that is saved
// to the level file, so it affects savegame compatibility.
// New features for Citadel pack by Andrea Rosa
//#define CITADELMOD_FEATURES
@ -207,9 +210,13 @@ MATHLIB
*/
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef vec_t vec5_t[5];
typedef byte color_t[4];
typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
@ -246,6 +253,20 @@ extern int Q_ftol (float f);
#define VectorNegate(a,b) (b[0]=-a[0],b[1]=-a[1],b[2]=-a[2])
#define VectorSet(v, x, y, z) (v[0]=(x), v[1]=(y), v[2]=(z))
#define Vector2Subtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1])
#define Vector2Add(a,b,c) (c[0]=a[0]+b[0],c[1]=a[1]+b[1])
#define Vector2Copy(a, b) (b[0]=a[0], b[1]=a[1])
#define Vector2Clear(a) (a[0]=a[1]=0)
#define Vector2Negate(a,b) (b[0]=-a[0],b[1]=-a[1])
#define Vector2Set(v, x, y) (v[0]=(x), v[1]=(y))
#define Vector4Subtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2],c[3]=a[3]-b[3])
#define Vector4Add(a,b,c) (c[0]=a[0]+b[0],c[1]=a[1]+b[1],c[2]=a[2]+b[2],c[3]=a[3]+b[3])
#define Vector4Copy(a, b) (b[0]=a[0], b[1]=a[1], b[2]=a[2], b[3]=a[3])
#define Vector4Clear(a) (a[0]=a[1]=a[2]=a[3]=0)
#define Vector4Negate(a,b) (b[0]=-a[0],b[1]=-a[1],b[2]=-a[2],b[3]=-a[3])
#define Vector4Set(v, w, x, y, z) (v[0]=(w), v[1]=(x), v[2]=(y), v[3]=(z))
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
// just in case you do't want to use the macros
@ -305,6 +326,8 @@ void COM_DefaultExtension (char *path, size_t pathSize, char *extension);
char *COM_Parse (char **data_p);
// data is an in/out parm, returns a parsed out token
qboolean Com_ParseColorString (const char *s, color_t outColor); // Knightmare added
void Com_sprintf (char *dest, size_t size, char *fmt, ...);
// Knightmare added
size_t Com_strcpy (char *dest, size_t destSize, const char *src);