moved function declarations of game syscalls to own header

This commit is contained in:
Walter Julius Hennecke 2014-10-09 20:15:26 +02:00
parent 788960f5d0
commit 38c6a7a8c8
39 changed files with 33569 additions and 33977 deletions

View file

@ -35,6 +35,8 @@
#include "inv.h" //indexes into the inventory #include "inv.h" //indexes into the inventory
#include "syn.h" //synonyms #include "syn.h" //synonyms
#include "match.h" //string matching types and vars #include "match.h" //string matching types and vars
//
#include "g_syscalls.h"
/* /*

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,8 @@
#include "syn.h" //synonyms #include "syn.h" //synonyms
#include "match.h" //string matching types and vars #include "match.h" //string matching types and vars
#include "g_syscalls.h"
//goal flag, see be_ai_goal.h for the other GFL_* //goal flag, see be_ai_goal.h for the other GFL_*
#define GFL_AIR 128 #define GFL_AIR 128

View file

@ -37,6 +37,8 @@
#include "syn.h" //synonyms #include "syn.h" //synonyms
#include "match.h" //string matching types and vars #include "match.h" //string matching types and vars
#include "g_syscalls.h"
#define IDEAL_ATTACKDIST 140 #define IDEAL_ATTACKDIST 140
#define WEAPONINDEX_PHASER 2 #define WEAPONINDEX_PHASER 2

View file

@ -37,6 +37,8 @@
#include "inv.h" #include "inv.h"
#include "syn.h" #include "syn.h"
#include "g_syscalls.h"
#define AI_MAX_PATH 144 #define AI_MAX_PATH 144

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,413 +1,414 @@
// Copyright (C) 1999-2000 Id Software, Inc. // Copyright (C) 1999-2000 Id Software, Inc.
// //
// //
// g_arenas.c // g_arenas.c
// //
#include "g_local.h" #include "g_local.h"
#include "g_client.h" #include "g_client.h"
#include "g_utils.h" #include "g_utils.h"
#include "g_syscalls.h"
#ifndef min
#define min(a, b) (a) < (b) ? a : b #ifndef min
#endif #define min(a, b) (a) < (b) ? a : b
#endif
gentity_t* podium1;
gentity_t* podium2; gentity_t* podium1;
gentity_t* podium3; gentity_t* podium2;
gentity_t* podium3;
void UpdateTournamentInfo(void) {
char msg[AWARDS_MSG_LENGTH]; void UpdateTournamentInfo(void) {
char msg2[AWARDS_MSG_LENGTH]; char msg[AWARDS_MSG_LENGTH];
char* mvpName = ""; char msg2[AWARDS_MSG_LENGTH];
int32_t i = 0; char* mvpName = "";
int32_t j = 0; int32_t i = 0;
int32_t k = 0; int32_t j = 0;
int32_t n = 0; int32_t k = 0;
int32_t playerClientNum = 0; int32_t n = 0;
int32_t playerRank = level.numNonSpectatorClients - 1; int32_t playerClientNum = 0;
int32_t highestTiedRank = 0; int32_t playerRank = level.numNonSpectatorClients - 1;
int32_t mvpNum = -1; int32_t highestTiedRank = 0;
int32_t mvpPoints = 0; int32_t mvpNum = -1;
int32_t winningCaptures = 0; int32_t mvpPoints = 0;
int32_t winningPoints = 0; int32_t winningCaptures = 0;
int32_t winningTeam=0; int32_t winningPoints = 0;
int32_t loseCaptures = 0; int32_t winningTeam=0;
int32_t losePoints = 0; int32_t loseCaptures = 0;
int32_t secondPlaceTied=0; int32_t losePoints = 0;
gentity_t* MVP = NULL; int32_t secondPlaceTied=0;
gentity_t* player = NULL; gentity_t* MVP = NULL;
gclient_t* cl = NULL; gentity_t* player = NULL;
gclient_t* cl2= NULL; gclient_t* cl = NULL;
gclient_t* cl2= NULL;
memset(msg, 0, AWARDS_MSG_LENGTH);
memset(msg2, 0, AWARDS_MSG_LENGTH); memset(msg, 0, AWARDS_MSG_LENGTH);
memset(msg2, 0, AWARDS_MSG_LENGTH);
// Was there a tie for second place on the podium?
cl = &level.clients[level.sortedClients[1]]; // Was there a tie for second place on the podium?
cl2= &level.clients[level.sortedClients[2]]; cl = &level.clients[level.sortedClients[1]];
if(cl->ps.persistant[PERS_SCORE] == cl2->ps.persistant[PERS_SCORE]) { cl2= &level.clients[level.sortedClients[2]];
secondPlaceTied = 1; if(cl->ps.persistant[PERS_SCORE] == cl2->ps.persistant[PERS_SCORE]) {
} secondPlaceTied = 1;
}
winningTeam = level.clients[0].ps.persistant[PERS_RANK]+1;
if((winningTeam != TEAM_BLUE) && (winningTeam != TEAM_RED)) { winningTeam = level.clients[0].ps.persistant[PERS_RANK]+1;
//tie or not a team game if((winningTeam != TEAM_BLUE) && (winningTeam != TEAM_RED)) {
winningTeam = 0; //tie or not a team game
} winningTeam = 0;
}
if(mvpNum < 0) {
//ah, crap no MVP, pick the first player on the winning team if(mvpNum < 0) {
for(i = 0; i < level.maxclients; i++) { //ah, crap no MVP, pick the first player on the winning team
if((&g_entities[i]) == NULL) { continue; } for(i = 0; i < level.maxclients; i++) {
if((&g_entities[i])->client == NULL) { continue; } if((&g_entities[i]) == NULL) { continue; }
if(g_entities[i].client->ps.persistant[PERS_TEAM] == winningTeam ) { if((&g_entities[i])->client == NULL) { continue; }
mvpNum = i; if(g_entities[i].client->ps.persistant[PERS_TEAM] == winningTeam ) {
break; mvpNum = i;
} break;
} }
} }
}
if(mvpNum >= 0) {
//still no MVP, so skip it if(mvpNum >= 0) {
MVP = &g_entities[mvpNum]; //still no MVP, so skip it
mvpName = MVP->client->pers.netname; MVP = &g_entities[mvpNum];
mvpPoints = MVP->client->ps.persistant[PERS_SCORE]; mvpName = MVP->client->pers.netname;
winningTeam = MVP->client->ps.persistant[PERS_TEAM]; mvpPoints = MVP->client->ps.persistant[PERS_SCORE];
} winningTeam = MVP->client->ps.persistant[PERS_TEAM];
}
if(winningTeam != 0) {
//one of the teams won if(winningTeam != 0) {
winningCaptures = level.teamScores[winningTeam]; //one of the teams won
winningCaptures = level.teamScores[winningTeam];
if(winningTeam == TEAM_RED) {
loseCaptures = level.teamScores[TEAM_BLUE]; if(winningTeam == TEAM_RED) {
} else { loseCaptures = level.teamScores[TEAM_BLUE];
loseCaptures = level.teamScores[TEAM_RED]; } else {
} loseCaptures = level.teamScores[TEAM_RED];
}
for(i = 0; i < level.maxclients; i++) {
if((&g_entities[i]) == NULL) { continue; } for(i = 0; i < level.maxclients; i++) {
if((&g_entities[i])->client == NULL) { continue; } if((&g_entities[i]) == NULL) { continue; }
if(g_entities[i].client->ps.persistant[PERS_TEAM] == winningTeam) { if((&g_entities[i])->client == NULL) { continue; }
winningPoints += g_entities[i].client->ps.persistant[PERS_SCORE]; if(g_entities[i].client->ps.persistant[PERS_TEAM] == winningTeam) {
} else { winningPoints += g_entities[i].client->ps.persistant[PERS_SCORE];
losePoints += g_entities[i].client->ps.persistant[PERS_SCORE]; } else {
} losePoints += g_entities[i].client->ps.persistant[PERS_SCORE];
} }
} }
}
for(i = 0; i < level.maxclients; i++) {
player = &g_entities[i]; for(i = 0; i < level.maxclients; i++) {
player = &g_entities[i];
if ((player == NULL) || (player->inuse == qfalse) || ((player->r.svFlags & SVF_BOT) != 0)) {
continue; if ((player == NULL) || (player->inuse == qfalse) || ((player->r.svFlags & SVF_BOT) != 0)) {
} continue;
playerClientNum = i; }
playerClientNum = i;
G_Client_CalculateRanks( qfalse );
// put info for the top three players into the msg G_Client_CalculateRanks( qfalse );
Com_sprintf(msg, AWARDS_MSG_LENGTH, "awards %d", level.numNonSpectatorClients); // put info for the top three players into the msg
for(j = 0; j < level.numNonSpectatorClients; j++) { Com_sprintf(msg, AWARDS_MSG_LENGTH, "awards %d", level.numNonSpectatorClients);
if(j > 2) { for(j = 0; j < level.numNonSpectatorClients; j++) {
break; if(j > 2) {
} break;
n = level.sortedClients[j]; }
strcpy(msg2, msg); n = level.sortedClients[j];
Com_sprintf(msg, AWARDS_MSG_LENGTH, "%s %d", msg2, n); strcpy(msg2, msg);
} Com_sprintf(msg, AWARDS_MSG_LENGTH, "%s %d", msg2, n);
}
// put this guy's awards into the msg
if(level.clients[playerClientNum].sess.sessionTeam == TEAM_SPECTATOR) { // put this guy's awards into the msg
strcpy(msg2, msg); if(level.clients[playerClientNum].sess.sessionTeam == TEAM_SPECTATOR) {
Com_sprintf( msg, sizeof(msg), "%s 0", msg2); strcpy(msg2, msg);
} Com_sprintf( msg, sizeof(msg), "%s 0", msg2);
}
// now supply...
// // now supply...
// 1) winning team's MVP's name //
// 2) winning team's MVP's score // 1) winning team's MVP's name
// 3) winning team's total captures // 2) winning team's MVP's score
// 4) winning team's total points // 3) winning team's total captures
// 5) this player's rank // 4) winning team's total points
// 6) the highest rank for which this player tied // 5) this player's rank
// 7) losing team's total captures // 6) the highest rank for which this player tied
// 8) losing team's total points // 7) losing team's total captures
// 9) if second place was tied // 8) losing team's total points
// 10) intermission point // 9) if second place was tied
// 11) intermission angles // 10) intermission point
// // 11) intermission angles
for(k = 0; k < level.numNonSpectatorClients; k++) { //
if(level.sortedClients[k] == playerClientNum) { for(k = 0; k < level.numNonSpectatorClients; k++) {
playerRank = k; if(level.sortedClients[k] == playerClientNum) {
break; playerRank = k;
} break;
} }
}
highestTiedRank = 0;
for(k = playerRank-1; k >= 0; k--) { highestTiedRank = 0;
cl = &level.clients[level.sortedClients[k]]; for(k = playerRank-1; k >= 0; k--) {
if (cl->ps.persistant[PERS_SCORE] > level.clients[level.sortedClients[playerRank]].ps.persistant[PERS_SCORE]) { cl = &level.clients[level.sortedClients[k]];
break; if (cl->ps.persistant[PERS_SCORE] > level.clients[level.sortedClients[playerRank]].ps.persistant[PERS_SCORE]) {
} break;
highestTiedRank = k+1; }
} highestTiedRank = k+1;
strcpy(msg2, msg); }
Com_sprintf(msg, AWARDS_MSG_LENGTH, "%s \"%s\" %d %d %d %d %d %d %d %d %f %f %f %f %f %f", strcpy(msg2, msg);
msg2, mvpName, mvpPoints, winningCaptures, winningPoints, playerRank, highestTiedRank, Com_sprintf(msg, AWARDS_MSG_LENGTH, "%s \"%s\" %d %d %d %d %d %d %d %d %f %f %f %f %f %f",
loseCaptures, losePoints, secondPlaceTied, level.intermission_origin[0], level.intermission_origin[1], msg2, mvpName, mvpPoints, winningCaptures, winningPoints, playerRank, highestTiedRank,
level.intermission_origin[2], level.intermission_angle[0], level.intermission_angle[1], loseCaptures, losePoints, secondPlaceTied, level.intermission_origin[0], level.intermission_origin[1],
level.intermission_angle[2]); level.intermission_origin[2], level.intermission_angle[0], level.intermission_angle[1],
level.intermission_angle[2]);
trap_SendServerCommand(player-g_entities, msg);
} trap_SendServerCommand(player-g_entities, msg);
}
if(g_gametype.integer == GT_SINGLE_PLAYER) {
Com_sprintf( msg, sizeof(msg), "postgame %i", playerRank); if(g_gametype.integer == GT_SINGLE_PLAYER) {
trap_SendConsoleCommand( EXEC_APPEND, msg); Com_sprintf( msg, sizeof(msg), "postgame %i", playerRank);
} trap_SendConsoleCommand( EXEC_APPEND, msg);
} }
}
static gentity_t* SpawnModelOnVictoryPad(gentity_t* pad, vec3_t offset, gentity_t* ent, int32_t place) {
gentity_t* body; static gentity_t* SpawnModelOnVictoryPad(gentity_t* pad, vec3_t offset, gentity_t* ent, int32_t place) {
vec3_t vec; gentity_t* body;
vec3_t f; vec3_t vec;
vec3_t r; vec3_t f;
vec3_t u; vec3_t r;
entityState_t* eState; vec3_t u;
entityShared_t* eShared; entityState_t* eState;
entityShared_t* eShared;
body = G_Spawn();
if(body == NULL) { body = G_Spawn();
G_Printf( S_COLOR_RED "ERROR: out of gentities\n" ); if(body == NULL) {
return NULL; G_Printf( S_COLOR_RED "ERROR: out of gentities\n" );
} return NULL;
}
eState = &body->s;
eShared = &body->r; eState = &body->s;
eShared = &body->r;
body->classname = ent->client->pers.netname;
body->client = ent->client; body->classname = ent->client->pers.netname;
eState = &ent->s; body->client = ent->client;
eState->eType = ET_PLAYER; // could be ET_INVISIBLE eState = &ent->s;
eState->eFlags = 0; // clear EF_TALK, etc eState->eType = ET_PLAYER; // could be ET_INVISIBLE
eState->powerups = 0; // clear powerups eState->eFlags = 0; // clear EF_TALK, etc
eState->loopSound = 0; // clear lava burning eState->powerups = 0; // clear powerups
eState->number = body - g_entities; eState->loopSound = 0; // clear lava burning
body->timestamp = level.time; eState->number = body - g_entities;
body->physicsObject = qtrue; body->timestamp = level.time;
body->physicsBounce = 0; // don't bounce body->physicsObject = qtrue;
eState->event = 0; body->physicsBounce = 0; // don't bounce
eState->pos.trType = TR_STATIONARY; eState->event = 0;
eState->groundEntityNum = ENTITYNUM_WORLD; eState->pos.trType = TR_STATIONARY;
eState->legsAnim = BOTH_STAND1; //TORSO_STAND eState->groundEntityNum = ENTITYNUM_WORLD;
eState->torsoAnim = BOTH_STAND1; eState->legsAnim = BOTH_STAND1; //TORSO_STAND
eState->torsoAnim = BOTH_STAND1;
// fix up some weapon holding / shooting issues
if (eState->weapon==WP_5 || eState->weapon==WP_13 || eState->weapon == WP_0 ) { // fix up some weapon holding / shooting issues
eState->weapon = WP_6; if (eState->weapon==WP_5 || eState->weapon==WP_13 || eState->weapon == WP_0 ) {
} eState->weapon = WP_6;
}
eState->event = 0;
eShared->svFlags = ent->r.svFlags; eState->event = 0;
VectorCopy (ent->r.mins, eShared->mins); eShared->svFlags = ent->r.svFlags;
VectorCopy (ent->r.maxs, eShared->maxs); VectorCopy (ent->r.mins, eShared->mins);
VectorCopy (ent->r.absmin, eShared->absmin); VectorCopy (ent->r.maxs, eShared->maxs);
VectorCopy (ent->r.absmax, eShared->absmax); VectorCopy (ent->r.absmin, eShared->absmin);
body->clipmask = CONTENTS_SOLID | CONTENTS_PLAYERCLIP; VectorCopy (ent->r.absmax, eShared->absmax);
eShared->contents = CONTENTS_BODY; body->clipmask = CONTENTS_SOLID | CONTENTS_PLAYERCLIP;
eShared->ownerNum = ent->r.ownerNum; eShared->contents = CONTENTS_BODY;
body->takedamage = qfalse; eShared->ownerNum = ent->r.ownerNum;
VectorSubtract( level.intermission_origin, pad->r.currentOrigin, vec ); body->takedamage = qfalse;
vectoangles( vec, eState->apos.trBase ); VectorSubtract( level.intermission_origin, pad->r.currentOrigin, vec );
eState->apos.trBase[PITCH] = 0; vectoangles( vec, eState->apos.trBase );
eState->apos.trBase[ROLL] = 0; eState->apos.trBase[PITCH] = 0;
eState->apos.trBase[ROLL] = 0;
AngleVectors( eState->apos.trBase, f, r, u );
VectorMA( pad->r.currentOrigin, offset[0], f, vec ); AngleVectors( eState->apos.trBase, f, r, u );
VectorMA( vec, offset[1], r, vec ); VectorMA( pad->r.currentOrigin, offset[0], f, vec );
VectorMA( vec, offset[2], u, vec ); VectorMA( vec, offset[1], r, vec );
VectorMA( vec, offset[2], u, vec );
G_SetOrigin( body, vec );
G_SetOrigin( body, vec );
trap_LinkEntity (body);
trap_LinkEntity (body);
body->count = place;
body->count = place;
return body;
} return body;
}
static void CelebrateStop(gentity_t* player) {
int32_t anim; static void CelebrateStop(gentity_t* player) {
int32_t anim;
anim = BOTH_STAND1; //TORSO_STAND
player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; anim = BOTH_STAND1; //TORSO_STAND
} player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
}
#define TIMER_GESTURE (34*66+50)
extern void BG_AddPredictableEventToPlayerstate(int32_t newEvent, int32_t eventParm, playerState_t* ps); #define TIMER_GESTURE (34*66+50)
static void CelebrateStart(gentity_t* player) extern void BG_AddPredictableEventToPlayerstate(int32_t newEvent, int32_t eventParm, playerState_t* ps);
{ static void CelebrateStart(gentity_t* player)
/*player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | TORSO_GESTURE; {
player->nextthink = level.time + TIMER_GESTURE; /*player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | TORSO_GESTURE;
player->think = CelebrateStop;*/ player->nextthink = level.time + TIMER_GESTURE;
player->think = CelebrateStop;*/
// We don't want the taunt sound effect because it interfears with the computer voice giving awards
// FIXME: just get timing right? // We don't want the taunt sound effect because it interfears with the computer voice giving awards
//FIXME: why does this get lost now? // FIXME: just get timing right?
BG_AddPredictableEventToPlayerstate( EV_TAUNT, 0, &player->client->ps ); //FIXME: why does this get lost now?
} BG_AddPredictableEventToPlayerstate( EV_TAUNT, 0, &player->client->ps );
}
static vec3_t offsetFirst = {0, 0, 64};
static vec3_t offsetSecond = {-10, 60, 44}; static vec3_t offsetFirst = {0, 0, 64};
static vec3_t offsetThird = {-19, -60, 35}; static vec3_t offsetSecond = {-10, 60, 44};
static vec3_t offsetThird = {-19, -60, 35};
static void PodiumPlacementThink(gentity_t* podium) {
vec3_t vec; static void PodiumPlacementThink(gentity_t* podium) {
vec3_t origin; vec3_t vec;
vec3_t f; vec3_t origin;
vec3_t r; vec3_t f;
vec3_t u; vec3_t r;
vec3_t u;
podium->nextthink = level.time + 100;
podium->nextthink = level.time + 100;
AngleVectors( level.intermission_angle, vec, NULL, NULL );
VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin ); AngleVectors( level.intermission_angle, vec, NULL, NULL );
origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" ); VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin );
G_SetOrigin( podium, origin ); origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" );
G_SetOrigin( podium, origin );
if(podium1 != NULL) {
VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec ); if(podium1 != NULL) {
vectoangles( vec, podium1->s.apos.trBase ); VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
podium1->s.apos.trBase[PITCH] = 0; vectoangles( vec, podium1->s.apos.trBase );
podium1->s.apos.trBase[ROLL] = 0; podium1->s.apos.trBase[PITCH] = 0;
podium1->s.apos.trBase[ROLL] = 0;
AngleVectors( podium1->s.apos.trBase, f, r, u );
VectorMA( podium->r.currentOrigin, offsetFirst[0], f, vec ); AngleVectors( podium1->s.apos.trBase, f, r, u );
VectorMA( vec, offsetFirst[1], r, vec ); VectorMA( podium->r.currentOrigin, offsetFirst[0], f, vec );
VectorMA( vec, offsetFirst[2], u, vec ); VectorMA( vec, offsetFirst[1], r, vec );
VectorMA( vec, offsetFirst[2], u, vec );
G_SetOrigin( podium1, vec );
} G_SetOrigin( podium1, vec );
}
if(podium2 != NULL) {
VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec ); if(podium2 != NULL) {
vectoangles( vec, podium2->s.apos.trBase ); VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
podium2->s.apos.trBase[PITCH] = 0; vectoangles( vec, podium2->s.apos.trBase );
podium2->s.apos.trBase[ROLL] = 0; podium2->s.apos.trBase[PITCH] = 0;
podium2->s.apos.trBase[ROLL] = 0;
AngleVectors( podium2->s.apos.trBase, f, r, u );
VectorMA( podium->r.currentOrigin, offsetSecond[0], f, vec ); AngleVectors( podium2->s.apos.trBase, f, r, u );
VectorMA( vec, offsetSecond[1], r, vec ); VectorMA( podium->r.currentOrigin, offsetSecond[0], f, vec );
VectorMA( vec, offsetSecond[2], u, vec ); VectorMA( vec, offsetSecond[1], r, vec );
VectorMA( vec, offsetSecond[2], u, vec );
G_SetOrigin( podium2, vec );
} G_SetOrigin( podium2, vec );
}
if(podium3 != NULL) {
VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec ); if(podium3 != NULL) {
vectoangles( vec, podium3->s.apos.trBase ); VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
podium3->s.apos.trBase[PITCH] = 0; vectoangles( vec, podium3->s.apos.trBase );
podium3->s.apos.trBase[ROLL] = 0; podium3->s.apos.trBase[PITCH] = 0;
podium3->s.apos.trBase[ROLL] = 0;
AngleVectors( podium3->s.apos.trBase, f, r, u );
VectorMA( podium->r.currentOrigin, offsetThird[0], f, vec ); AngleVectors( podium3->s.apos.trBase, f, r, u );
VectorMA( vec, offsetThird[1], r, vec ); VectorMA( podium->r.currentOrigin, offsetThird[0], f, vec );
VectorMA( vec, offsetThird[2], u, vec ); VectorMA( vec, offsetThird[1], r, vec );
VectorMA( vec, offsetThird[2], u, vec );
G_SetOrigin( podium3, vec );
} G_SetOrigin( podium3, vec );
} }
}
static gentity_t* SpawnPodium( void ) {
gentity_t* podium; static gentity_t* SpawnPodium( void ) {
vec3_t vec; gentity_t* podium;
vec3_t origin; vec3_t vec;
vec3_t origin;
podium = G_Spawn();
if(podium == NULL) { podium = G_Spawn();
return NULL; if(podium == NULL) {
} return NULL;
}
podium->classname = "podium";
podium->s.eType = ET_GENERAL; podium->classname = "podium";
podium->s.number = podium - g_entities; podium->s.eType = ET_GENERAL;
podium->clipmask = CONTENTS_SOLID; podium->s.number = podium - g_entities;
podium->r.contents = CONTENTS_SOLID; podium->clipmask = CONTENTS_SOLID;
if(g_gametype.integer > GT_SINGLE_PLAYER) { podium->r.contents = CONTENTS_SOLID;
podium->s.modelindex = G_ModelIndex( TEAM_PODIUM_MODEL ); if(g_gametype.integer > GT_SINGLE_PLAYER) {
} else { podium->s.modelindex = G_ModelIndex( TEAM_PODIUM_MODEL );
podium->s.modelindex = G_ModelIndex( SP_PODIUM_MODEL ); } else {
} podium->s.modelindex = G_ModelIndex( SP_PODIUM_MODEL );
}
AngleVectors( level.intermission_angle, vec, NULL, NULL );
VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin ); AngleVectors( level.intermission_angle, vec, NULL, NULL );
origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" ); VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin );
G_SetOrigin( podium, origin ); origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" );
G_SetOrigin( podium, origin );
VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
podium->s.apos.trBase[YAW] = vectoyaw( vec ); VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
trap_LinkEntity (podium); podium->s.apos.trBase[YAW] = vectoyaw( vec );
trap_LinkEntity (podium);
podium->think = PodiumPlacementThink;
podium->nextthink = level.time + 100; podium->think = PodiumPlacementThink;
return podium; podium->nextthink = level.time + 100;
} return podium;
}
void SpawnModelsOnVictoryPads( void ) {
gentity_t* player; void SpawnModelsOnVictoryPads( void ) {
gentity_t* podium; gentity_t* player;
gentity_t* podium;
podium1 = NULL;
podium2 = NULL; podium1 = NULL;
podium3 = NULL; podium2 = NULL;
podium3 = NULL;
podium = SpawnPodium();
podium = SpawnPodium();
player = SpawnModelOnVictoryPad( podium, offsetFirst, &g_entities[level.sortedClients[0]],
level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); player = SpawnModelOnVictoryPad( podium, offsetFirst, &g_entities[level.sortedClients[0]],
level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
if (player != NULL) {
player->nextthink = level.time + 2000; if (player != NULL) {
player->think = CelebrateStart; player->nextthink = level.time + 2000;
podium1 = player; player->think = CelebrateStart;
} podium1 = player;
}
// For non team game types, we want to spawn 3 characters on the victory pad
// For team games (GT_TEAM, GT_CTF) we want to have only a single player on the pad // For non team game types, we want to spawn 3 characters on the victory pad
if(( g_gametype.integer == GT_FFA ) || (g_gametype.integer == GT_TOURNAMENT) || (g_gametype.integer == GT_SINGLE_PLAYER)) { // For team games (GT_TEAM, GT_CTF) we want to have only a single player on the pad
if( level.numNonSpectatorClients > 1 ) { if(( g_gametype.integer == GT_FFA ) || (g_gametype.integer == GT_TOURNAMENT) || (g_gametype.integer == GT_SINGLE_PLAYER)) {
player = SpawnModelOnVictoryPad( podium, offsetSecond, &g_entities[level.sortedClients[1]], if( level.numNonSpectatorClients > 1 ) {
level.clients[ level.sortedClients[1] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); player = SpawnModelOnVictoryPad( podium, offsetSecond, &g_entities[level.sortedClients[1]],
if(player != NULL) { level.clients[ level.sortedClients[1] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
podium2 = player; if(player != NULL) {
} podium2 = player;
} }
}
if( level.numNonSpectatorClients > 2 ) {
player = SpawnModelOnVictoryPad( podium, offsetThird, &g_entities[level.sortedClients[2]], if( level.numNonSpectatorClients > 2 ) {
level.clients[ level.sortedClients[2] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); player = SpawnModelOnVictoryPad( podium, offsetThird, &g_entities[level.sortedClients[2]],
if(player != NULL) { level.clients[ level.sortedClients[2] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
podium3 = player; if(player != NULL) {
} podium3 = player;
} }
} }
} }
}
void Svcmd_AbortPodium_f( void ) {
if( g_gametype.integer != GT_SINGLE_PLAYER ) { void Svcmd_AbortPodium_f( void ) {
return; if( g_gametype.integer != GT_SINGLE_PLAYER ) {
} return;
}
if( podium1 != NULL ) {
podium1->nextthink = level.time; if( podium1 != NULL ) {
podium1->think = CelebrateStop; podium1->nextthink = level.time;
} podium1->think = CelebrateStop;
} }
}

View file

@ -5,6 +5,7 @@
#include "g_local.h" #include "g_local.h"
#include "g_main.h" #include "g_main.h"
#include "g_client.h" #include "g_client.h"
#include "g_syscalls.h"
static int32_t g_numBots; static int32_t g_numBots;

View file

@ -4,6 +4,7 @@
#include "g_items.h" #include "g_items.h"
#include "g_combat.h" #include "g_combat.h"
#include "g_utils.h" #include "g_utils.h"
#include "g_syscalls.h"
/** /**
* \brief A func_breakables health has sunk to or under zero * \brief A func_breakables health has sunk to or under zero

View file

@ -1,81 +1,82 @@
#include "g_cinematic.h" #include "g_cinematic.h"
#include "g_local.h" #include "g_local.h"
#include "g_client.h" #include "g_client.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_syscalls.h"
extern void InitMover( gentity_t *ent );
extern void InitMover( gentity_t *ent );
/*QUAKED cinematic_camera (0 0.5 0) (-4 -4 -4) (4 4 4)
-----DESCRIPTION----- /*QUAKED cinematic_camera (0 0.5 0) (-4 -4 -4) (4 4 4)
Camera for cinematic. Normally spawn by Lua script. -----DESCRIPTION-----
Camera for cinematic. Normally spawn by Lua script.
-----SPAWNFLAGS-----
none -----SPAWNFLAGS-----
none
-----KEYS-----
none -----KEYS-----
none
-----LUA-----
To be written later. -----LUA-----
*/ To be written later.
void SP_cinematic_camera(gentity_t *ent) { */
ent->type = ENT_CINEMATIC_CAMMERA; void SP_cinematic_camera(gentity_t *ent) {
trap_LinkEntity(ent); ent->type = ENT_CINEMATIC_CAMMERA;
InitMover(ent); trap_LinkEntity(ent);
} InitMover(ent);
}
void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target) {
gclient_t *client; void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target) {
gclient_t *client;
if(!ent || !ent->client || (ent->flags & FL_CCAM)) return;
client = ent->client; if(!ent || !ent->client || (ent->flags & FL_CCAM)) return;
client = ent->client;
ent->flags ^= FL_CCAM;
client->ps.pm_type = PM_CCAM; ent->flags ^= FL_CCAM;
client->cam = target; client->ps.pm_type = PM_CCAM;
VectorCopy(client->ps.viewangles, client->origViewAngles); client->cam = target;
VectorCopy(ent->r.currentOrigin, client->origOrigin); VectorCopy(client->ps.viewangles, client->origViewAngles);
G_Client_SetViewAngle(ent, target->s.angles); VectorCopy(ent->r.currentOrigin, client->origOrigin);
G_SetOrigin(ent, target->r.currentOrigin); G_Client_SetViewAngle(ent, target->s.angles);
VectorCopy(target->r.currentOrigin, ent->client->ps.origin); G_SetOrigin(ent, target->r.currentOrigin);
trap_LinkEntity(ent); VectorCopy(target->r.currentOrigin, ent->client->ps.origin);
} trap_LinkEntity(ent);
}
void Cinematic_DeactivateCameraMode(gentity_t *ent) {
gclient_t *client; void Cinematic_DeactivateCameraMode(gentity_t *ent) {
gclient_t *client;
if(!ent || !ent->client || !(ent->flags & FL_CCAM)) return;
client = ent->client; if(!ent || !ent->client || !(ent->flags & FL_CCAM)) return;
client = ent->client;
client->cam = NULL;
client->cam = NULL;
G_Printf("resetting origin to %s\n", vtos(client->origOrigin));
G_Printf("resetting origin to %s\n", vtos(client->origOrigin));
G_SetOrigin(ent, client->origOrigin);
VectorCopy(client->origOrigin, ent->client->ps.origin); G_SetOrigin(ent, client->origOrigin);
G_Client_SetViewAngle(ent, client->origViewAngles); VectorCopy(client->origOrigin, ent->client->ps.origin);
trap_LinkEntity(ent); G_Client_SetViewAngle(ent, client->origViewAngles);
trap_LinkEntity(ent);
}
}
void Cinematic_ActivateGlobalCameraMode(gentity_t *target) {
int i; void Cinematic_ActivateGlobalCameraMode(gentity_t *target) {
gentity_t *ent; int i;
gentity_t *ent;
for(i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i; for(i = 0; i < g_maxclients.integer; i++) {
if(!ent || !ent->client) continue; ent = g_entities + i;
Cinematic_ActivateCameraMode(ent, target); if(!ent || !ent->client) continue;
} Cinematic_ActivateCameraMode(ent, target);
} }
}
void Cinematic_DeactivateGlobalCameraMode(void) {
int i; void Cinematic_DeactivateGlobalCameraMode(void) {
gentity_t *ent; int i;
gentity_t *ent;
for(i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i; for(i = 0; i < g_maxclients.integer; i++) {
if(!ent || !ent->client) continue; ent = g_entities + i;
Cinematic_DeactivateCameraMode(ent); if(!ent || !ent->client) continue;
} Cinematic_DeactivateCameraMode(ent);
} }
}

View file

@ -10,6 +10,7 @@
#include "g_items.h" #include "g_items.h"
#include "g_lua.h" #include "g_lua.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_syscalls.h"
reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients
int32_t g_reconNum; int32_t g_reconNum;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2190,464 +2190,6 @@ extern vmCvar_t dev_showTriggers;
extern vmCvar_t rpg_spEasterEggs; extern vmCvar_t rpg_spEasterEggs;
//RPG-X - Stephen: Some global varibles for RPG-X
//extern int lastTimedMessage; //The last timed message that was displayed
//TiM - since we'll only use this in g_active, why not reduce its scope to make things easier. :)
/**
* Call G_PRINT in the engine.
* \param fmt format string.
*/
void trap_Printf( const char* fmt );
/**
* Calls Com_error in the engine
* \param fmt error desription
*/
void trap_Error( const char* fmt );
/**
* Get milliseconds since engine start
* \return milliseconds since engine start
*/
int trap_Milliseconds( void );
/**
* Get count of arguments for the current client game command
* \return count of arguments
*/
int trap_Argc( void );
/**
* Get a n of the current client game command
* \param n argument to get
* \param buffer buffer to store the argument in
* \param bufferLength size of the buffer
*/
void trap_Argv( int n, char* buffer, int bufferLength );
/**
* Get all args of the current client game command
* \param buffer buffer to store the arguments in
* \param bufferLength size of the buffer
*/
void trap_Args( char* buffer, int bufferLength );
/**
* Opens a file
* \param qpath path and filename
* \param f filehandle to use
* \param mode mode to use
*/
int trap_FS_FOpenFile( const char* qpath, fileHandle_t* f, fsMode_t mode );
/**
* Read a opened file
* \param buffer buffer to read to
* \param len buffer length or length to read (<sizeof(buffer))
* \param f filehandle for the file to read from
*
* You have to open the file first.
*/
void trap_FS_Read( void* buffer, int len, fileHandle_t f );
/**
* Write to a file
* \param buffer text to write
* \param len length of buffer
* \param f filehandle for the file to write to
*
* You have to open the file first.
*/
void trap_FS_Write( const void* buffer, int len, fileHandle_t f );
/**
* Close a file
* \param f filehandle for file to close
*/
void trap_FS_FCloseFile( fileHandle_t f );
/**
* Get a list of files in a path
* \param path path to get the list for
* \param extension filter to get only files with this extension
* \param listbuf buffer to store the file list in
* \param bufsize size of the buffer
* \return number of files in the list
*/
int trap_FS_GetFileList( const char* path, const char* extension, char* listbuf, int bufsize );
/**
* Sends a console command to execute to the client console
* \param exec_when when to exec (e.g. EXEC_APPEND)
* \param text the command to execute
*/
void trap_SendConsoleCommand( int exec_when, const char *text );
/**
* Register a cvar
* \param cvar representation of the cvar in the vm
* \param var_name name of the cvar
* \param value default value for the cvar
* \param flags additional options for the cvar (e.g. CVAR_ARCHIVE)
*/
void trap_Cvar_Register( /*@null@*/ vmCvar_t* cvar, const char* var_name, const char* value, int flags );
/**
* \brief Update a cvar.
*
* Tells the server/engine that a cvar in the vm has changed.
* \param cvar cvar to update
*/
void trap_Cvar_Update( vmCvar_t* cvar );
/**
* Set the cvar to a value.
* \param var_name name of the cvar to set
* \param value new value for the cvar
*/
void trap_Cvar_Set( const char* var_name, const char* value );
/**
* Get the integer value for an cvar
* \param var_name name of the cvar
*/
int trap_Cvar_VariableIntegerValue( const char* var_name );
/**
* Get the value of the cvar as string
* \param var_name name of the cvar
* \param buffer to store the value
* \param bufsize size of the buffer
*/
void trap_Cvar_VariableStringBuffer( const char* var_name, char* buffer, int bufsize );
/**
* Send some information of the current game/map to the server
* \param pointer to level.entities which is g_entities
* \param numGEntities number of game entities (level.num_entities)
* \param sizeofGEntity_t size of gentity_t
* \param gameClients level.clients[0].ps
* \param sizeOfGameClient size of level.clients[0]
*/
void trap_LocateGameData( gentity_t* gEnts, int numGEntities, int sizeofGEntity_t, playerState_t* gameClients, int sizeofGameClient );
/**
* Drop a client from server.
* \param clientNum client number of client to drop
* \param test reason for client drop
*/
void trap_DropClient( int clientNum, const char* reason );
/**
* \brief Send a server command to the client
* \param clientNum client number of client
* \param server command to execute
*
* A value of -1 for clientNum will send the command to all clients.
*/
void trap_SendServerCommand( int clientNum, const char* text );
/**
* Set a configstring
* \param num CS_...
* \param string set cofig string to this
*/
void trap_SetConfigstring( int num, /*@null@*/ const char* string );
/**
* Get a configstring
* \param num CS_...
* \param buffer buffer to store config string in
* \param bufferSize size of buffer
*/
void trap_GetConfigstring( int num, char* buffer, size_t bufferSize );
/**
* Get the userinfo for a client
* \param num client number
* \param buffer buffer to store config string in
* \param size of buffer
*/
void trap_GetUserinfo( int num, char* buffer, int bufferSize );
/**
* Set the userinfo for a client
* \param num client number
* \param buffer string the contains new userinfo
*/
void trap_SetUserinfo( int num, const char* buffer );
/**
* Get server info.
* \param buffer buffer to store the info in
* \param bufferSize size of buffer
*/
void trap_GetServerinfo( char* buffer, size_t bufferSize );
/**
* \brief Set the brush model for a entity.
* \param ent entity to the the model on
* \param name the model name
*
* The normal case is trap_SetBrushModel(ent, ent->model).
* Brush models always have names of *<int>.
*/
void trap_SetBrushModel( gentity_t* ent, const char* name );
/**
* \brief Do a trace on the server
* \param results trace_t to store the results in
* \param start startpoint
* \param end endpoint
* \param mins used to define the volume size
* \param maxs uses to define the volume size
* \param passEntityNum entity/entities to ignore
* \param contentmask only check for this contents (CONTENT_...)
*
* This actually moves a box with the size defined by mins and maxs through the world
* from start to end and checks whether it colides with anything that matches the contentmask.
* The entities that math the passEntityNum will be ingnored.
*/
void trap_Trace( trace_t* results, const vec3_t start, /*@null@*/ const vec3_t mins, /*@null@*/ const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
/**
* \param point the point
* \param passEntityNum ingore this
*
* Works similar to a trace but only check a single point.
*/
int trap_PointContents( const vec3_t point, int passEntityNum );
qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 );
/**
* Adjust the state of a area portal used for doors etc
* \param ent entity that effects the areaportal (area portal is inide the entities bounds)
* \param open open or close it?
*/
void trap_AdjustAreaPortalState( gentity_t* ent, qboolean open );
/**
* Checks if two areas are connected.
*/
qboolean trap_AreasConnected( int area1, int area2 );
/**
* Link an entity.
* This results in shared values beeing avaible on both game and client side.
*/
void trap_LinkEntity( gentity_t* ent );
/**
* Unlinks an entity.
*/
void trap_UnlinkEntity( gentity_t* ent );
/**
* \brief Get a list of all entities in a box.
* \param entityList list where entitynums will be stored
* \param maxcount limits the number of listed entities
*
* The size of the box is defined by mins and maxs.
*/
int trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int32_t* entityList, int maxcount );
/**
* Checks if a entity is in contact with a defined box.
*/
qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t* ent );
/**
* Allocates a free client for a bot.
*/
int trap_BotAllocateClient( void );
/**
* Free the client that was used for a bot.
*/
void trap_BotFreeClient( int clientNum );
/**
* Get the last command a user did.
*/
void trap_GetUsercmd( int clientNum, usercmd_t* cmd );
/**
* Get entity token.
*/
qboolean trap_GetEntityToken( char* buffer, int bufferSize );
/**
* Create a debug polygon.
*
* \param color color of the polygon
* \param numPoints number of points the polygon has
* \param points points of the polygon
* \return Polgon id
*/
int trap_DebugPolygonCreate(int color, int numPoints, vec3_t* points);
/**
* Deletes a debug polygon.
*
* \param id id of polygon to delete
*/
void trap_DebugPolygonDelete(int id);
int trap_BotLibSetup( void );
int trap_BotLibShutdown( void );
int trap_BotLibVarSet(char* var_name, char* value);
int trap_BotLibVarGet(char* var_name, char* value, int size);
int trap_BotLibDefine(char* string);
int trap_BotLibStartFrame(float time);
int trap_BotLibLoadMap(const char* mapname);
int trap_BotLibUpdateEntity(int ent, void* bue);
int trap_BotLibTest(int parm0, char* parm1, vec3_t parm2, vec3_t parm3);
int trap_BotGetSnapshotEntity( int clientNum, int sequence );
int trap_BotGetConsoleMessage(int clientNum, char* message, int size);
void trap_BotUserCommand(int client, usercmd_t* ucmd);
void trap_AAS_EntityInfo(int entnum, void* info);
int trap_AAS_Initialized(void);
void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
float trap_AAS_Time(void);
int trap_AAS_PointAreaNum(vec3_t point);
int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int* areas, vec3_t* points, int maxareas);
int trap_AAS_PointContents(vec3_t point);
int trap_AAS_NextBSPEntity(int ent);
int trap_AAS_ValueForBSPEpairKey(int ent, char* key, char* value, int size);
int trap_AAS_VectorForBSPEpairKey(int ent, char* key, vec3_t v);
int trap_AAS_FloatForBSPEpairKey(int ent, char* key, float* value);
int trap_AAS_IntForBSPEpairKey(int ent, char* key, int* value);
int trap_AAS_AreaReachability(int areanum);
int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
int trap_AAS_Swimming(vec3_t origin);
int trap_AAS_PredictClientMovement(void* move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize);
void trap_EA_Say(int client, char* str);
void trap_EA_SayTeam(int client, char* str);
void trap_EA_SayClass(int client, char* str);
void trap_EA_UseItem(int client, char* it);
void trap_EA_DropItem(int client, char* it);
void trap_EA_UseInv(int client, char* inv);
void trap_EA_DropInv(int client, char* inv);
void trap_EA_Gesture(int client);
void trap_EA_Command(int client, char* command);
void trap_EA_SelectWeapon(int client, int weapon);
void trap_EA_Talk(int client);
void trap_EA_Attack(int client);
void trap_EA_Alt_Attack(int client);
void trap_EA_Use(int client);
void trap_EA_Respawn(int client);
void trap_EA_Jump(int client);
void trap_EA_DelayedJump(int client);
void trap_EA_Crouch(int client);
void trap_EA_MoveUp(int client);
void trap_EA_MoveDown(int client);
void trap_EA_MoveForward(int client);
void trap_EA_MoveBack(int client);
void trap_EA_MoveLeft(int client);
void trap_EA_MoveRight(int client);
void trap_EA_Move(int client, vec3_t dir, float speed);
void trap_EA_View(int client, vec3_t viewangles);
void trap_EA_EndRegular(int client, float thinktime);
void trap_EA_GetInput(int client, float thinktime, void* input);
void trap_EA_ResetInput(int client);
int trap_BotLoadCharacter(char* charfile, int skill);
void trap_BotFreeCharacter(int character);
float trap_Characteristic_Float(int character, int index);
float trap_Characteristic_BFloat(int character, int index, float min, float max);
int trap_Characteristic_Integer(int character, int index);
int trap_Characteristic_BInteger(int character, int index, int min, int max);
void trap_Characteristic_String(int character, int index, char *buf, int size);
int trap_BotAllocChatState(void);
void trap_BotFreeChatState(int handle);
void trap_BotQueueConsoleMessage(int chatstate, int type, char* message);
void trap_BotRemoveConsoleMessage(int chatstate, int handle);
int trap_BotNextConsoleMessage(int chatstate, void* cm);
int trap_BotNumConsoleMessages(int chatstate);
void trap_BotInitialChat(int chatstate, char* type, int mcontext, char* var0, char* var1, char* var2, char* var3, char* var4, char* var5, char* var6, char* var7 );
int trap_BotNumInitialChats(int chatstate, char* type);
int trap_BotReplyChat(int chatstate, char* message, int mcontext, int vcontext, char* var0, char* var1, char* var2, char* var3, char* var4, char* var5, char* var6, char* var7 );
int trap_BotChatLength(int chatstate);
void trap_BotEnterChat(int chatstate, int client, int sendto);
void trap_BotGetChatMessage(int chatstate, char* buf, int size);
int trap_StringContains(char* str1, char* str2, int casesensitive);
int trap_BotFindMatch(char* str, void* match, unsigned long int context);
void trap_BotMatchVariable(void* match, int variable, char* buf, int size);
void trap_UnifyWhiteSpaces(char* string);
void trap_BotReplaceSynonyms(char* string, unsigned long int context);
int trap_BotLoadChatFile(int chatstate, char* chatfile, char* chatname);
void trap_BotSetChatGender(int chatstate, int gender);
void trap_BotSetChatName(int chatstate, char* name);
void trap_BotResetGoalState(int goalstate);
void trap_BotRemoveFromAvoidGoals(int goalstate, int number);
void trap_BotResetAvoidGoals(int goalstate);
void trap_BotPushGoal(int goalstate, void* goal);
void trap_BotPopGoal(int goalstate);
void trap_BotEmptyGoalStack(int goalstate);
void trap_BotDumpAvoidGoals(int goalstate);
void trap_BotDumpGoalStack(int goalstate);
void trap_BotGoalName(int number, char* name, int size);
int trap_BotGetTopGoal(int goalstate, void* goal);
int trap_BotGetSecondGoal(int goalstate, void* goal);
int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int* inventory, int travelflags, qboolean botRoamsOnly );
int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int* inventory, int travelflags, void* ltg, float maxtime, qboolean botRoamsOnly);
int trap_BotTouchingGoal(vec3_t origin, void* goal);
int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void* goal);
int trap_BotGetNextCampSpotGoal(int num, void* goal);
int trap_BotGetMapLocationGoal(char* name, void* goal);
int trap_BotGetLevelItemGoal(int index, char* classname, void* goal);
float trap_BotAvoidGoalTime(int goalstate, int number);
void trap_BotInitLevelItems(void);
void trap_BotUpdateEntityItems(void);
int trap_BotLoadItemWeights(int goalstate, char* filename);
void trap_BotFreeItemWeights(int goalstate);
void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
void trap_BotSaveGoalFuzzyLogic(int goalstate, char* filename);
void trap_BotMutateGoalFuzzyLogic(int goalstate, float range);
int trap_BotAllocGoalState(int state);
void trap_BotFreeGoalState(int handle);
void trap_BotResetMoveState(int movestate);
void trap_BotMoveToGoal(void* result, int movestate, void* goal, int travelflags);
int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
void trap_BotResetAvoidReach(int movestate);
void trap_BotResetLastAvoidReach(int movestate);
int trap_BotReachabilityArea(vec3_t origin, int testground);
int trap_BotMovementViewTarget(int movestate, void* goal, int travelflags, float lookahead, vec3_t target);
int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void* goal, int travelflags, vec3_t target);
int trap_BotAllocMoveState(void);
void trap_BotFreeMoveState(int handle);
void trap_BotInitMoveState(int handle, void* initmove);
int trap_BotChooseBestFightWeapon(int weaponstate, int* inventory, qboolean meleeRange);
void trap_BotGetWeaponInfo(int weaponstate, int weapon, void* weaponinfo);
int trap_BotLoadWeaponWeights(int weaponstate, char* filename);
int trap_BotAllocWeaponState(void);
void trap_BotFreeWeaponState(int weaponstate);
void trap_BotResetWeaponState(int weaponstate);
int trap_GeneticParentsAndChildSelection(int numranks, float* ranks, int* parent1, int* parent2, int* child);
//OUMS //OUMS
/** \typedef holoData_t /** \typedef holoData_t

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
#include "g_utils.h" #include "g_utils.h"
#include "g_mover.h" #include "g_mover.h"
#include "g_weapon.h" #include "g_weapon.h"
#include "g_syscalls.h"
extern void BG_LoadItemNames(void); extern void BG_LoadItemNames(void);
extern qboolean BG_ParseRankNames(char* fileName, rankNames_t rankNames[], size_t size); extern qboolean BG_ParseRankNames(char* fileName, rankNames_t rankNames[], size_t size);

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@
#include "g_missile.h" #include "g_missile.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_combat.h" #include "g_combat.h"
#include "g_syscalls.h"
#define MISSILE_PRESTEP_TIME 50 #define MISSILE_PRESTEP_TIME 50

View file

@ -8,6 +8,7 @@
#include "g_lua.h" #include "g_lua.h"
#include "g_utils.h" #include "g_utils.h"
#include "q_math.h" #include "q_math.h"
#include "g_syscalls.h"
extern qboolean G_CallSpawn(gentity_t *ent); extern qboolean G_CallSpawn(gentity_t *ent);

View file

@ -2,6 +2,7 @@
// //
#include "g_local.h" #include "g_local.h"
#include "g_main.h" #include "g_main.h"
#include "g_syscalls.h"
/* /*

View file

@ -5,6 +5,7 @@
#include "g_spawn.h" #include "g_spawn.h"
#include "g_items.h" #include "g_items.h"
#include "g_lua.h" #include "g_lua.h"
#include "g_syscalls.h"
field_t fields[] = { field_t fields[] = {
{ "classname", FOFS(classname), F_LSTRING }, { "classname", FOFS(classname), F_LSTRING },

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
// Copyright (C) 1999-2000 Id Software, Inc. // Copyright (C) 1999-2000 Id Software, Inc.
// //
#include "g_local.h" #include "g_syscalls.h"
// this file is only included when building a dll // this file is only included when building a dll
// g_syscalls.asm is included instead when building a qvm // g_syscalls.asm is included instead when building a qvm

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@
#include "g_spawn.h" #include "g_spawn.h"
#include "g_trigger.h" #include "g_trigger.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_syscalls.h"
#define UI_DIABLED 1 #define UI_DIABLED 1
/*QUAKED ui_transporter (1 0.5 0) (-8 -8 -8) (8 8 8) ? DISABLED /*QUAKED ui_transporter (1 0.5 0) (-8 -8 -8) (8 8 8) ? DISABLED

View file

@ -3,6 +3,7 @@
#include "g_spawn.h" #include "g_spawn.h"
#include "g_client.h" #include "g_client.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_syscalls.h"
#define USABLE_START_OFF 1 #define USABLE_START_OFF 1
#define USABLE_AUTOANIM 2 #define USABLE_AUTOANIM 2

View file

@ -10,6 +10,7 @@
#include "g_lua.h" #include "g_lua.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_combat.h" #include "g_combat.h"
#include "g_syscalls.h"
/** /**
* \brief Data structure for a singele shader remap. * \brief Data structure for a singele shader remap.

View file

@ -13,6 +13,7 @@
#include "g_combat.h" #include "g_combat.h"
#include "q_math.h" #include "q_math.h"
#include "bg_lex.h" #include "bg_lex.h"
#include "g_syscalls.h"
weaponConfig_t weaponConfig; weaponConfig_t weaponConfig;

View file

@ -1,119 +1,121 @@
// lua library for cvars // lua library for cvars
#include "g_lua.h" #include "g_lua.h"
#include <string.h>
#ifdef G_LUA
#ifdef G_LUA
#include <string.h>
/*** #include "g_syscalls.h"
This module allows getting and setting game cvars.
@module cvar /***
*/ This module allows getting and setting game cvars.
@module cvar
/*** */
Get cvar value as integer.
@function integer /***
@param name Cvar name. Get cvar value as integer.
@return Cvar value as integer. @function integer
*/ @param name Cvar name.
static int Cvar_Integer(lua_State *L) { @return Cvar value as integer.
char *cvar; */
char buf[1024]; static int Cvar_Integer(lua_State *L) {
char *cvar;
cvar = (char *)luaL_checkstring(L, 1); char buf[1024];
if(!cvar[0]) {
lua_pushinteger(L, 0); cvar = (char *)luaL_checkstring(L, 1);
return 1; if(!cvar[0]) {
} lua_pushinteger(L, 0);
if(strstr(Q_strlwr(cvar), "password") != NULL return 1;
|| strstr(Q_strlwr(cvar), "pass") != NULL }
|| strstr(Q_strlwr(cvar), "sql") != NULL) { if(strstr(Q_strlwr(cvar), "password") != NULL
lua_pushinteger(L, 0); || strstr(Q_strlwr(cvar), "pass") != NULL
return 1; || strstr(Q_strlwr(cvar), "sql") != NULL) {
} lua_pushinteger(L, 0);
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf)); return 1;
lua_pushinteger(L, atoi(buf)); }
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf));
return 1; lua_pushinteger(L, atoi(buf));
}
return 1;
/*** }
Get cvar value as floating point number.
@function value /***
@param name Cvar name. Get cvar value as floating point number.
@return Cvar value as floating point number. @function value
*/ @param name Cvar name.
static int Cvar_Value(lua_State *L) { @return Cvar value as floating point number.
char *cvar; */
char buf[1024]; static int Cvar_Value(lua_State *L) {
char *cvar;
cvar = (char *)luaL_checkstring(L, 1); char buf[1024];
if(!cvar[0]) {
lua_pushnumber(L, 0); cvar = (char *)luaL_checkstring(L, 1);
return 1; if(!cvar[0]) {
} lua_pushnumber(L, 0);
if(strstr(Q_strlwr(cvar), "password") != NULL return 1;
|| strstr(Q_strlwr(cvar), "pass") != NULL }
|| strstr(Q_strlwr(cvar), "sql") != NULL) { if(strstr(Q_strlwr(cvar), "password") != NULL
lua_pushnumber(L, 0); || strstr(Q_strlwr(cvar), "pass") != NULL
return 1; || strstr(Q_strlwr(cvar), "sql") != NULL) {
} lua_pushnumber(L, 0);
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf)); return 1;
lua_pushnumber(L, atof(buf)); }
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf));
return 1; lua_pushnumber(L, atof(buf));
}
return 1;
/*** }
Get cvar value as string.
@function string /***
@param name Cvar name. Get cvar value as string.
@return Cvar value as string. @function string
*/ @param name Cvar name.
static int Cvar_String(lua_State *L) { @return Cvar value as string.
char *cvar; */
char buf[1024]; static int Cvar_String(lua_State *L) {
char *cvar;
cvar = (char *)luaL_checkstring(L, 1); char buf[1024];
if(!cvar[0]) {
lua_pushstring(L, ""); cvar = (char *)luaL_checkstring(L, 1);
return 1; if(!cvar[0]) {
} lua_pushstring(L, "");
if(strstr(Q_strlwr(cvar), "password") != NULL return 1;
|| strstr(Q_strlwr(cvar), "pass") != NULL }
|| strstr(Q_strlwr(cvar), "sql") != NULL) { if(strstr(Q_strlwr(cvar), "password") != NULL
lua_pushstring(L, ""); || strstr(Q_strlwr(cvar), "pass") != NULL
return 1; || strstr(Q_strlwr(cvar), "sql") != NULL) {
} lua_pushstring(L, "");
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf)); return 1;
lua_pushstring(L, buf); }
trap_Cvar_VariableStringBuffer(cvar, buf, sizeof(buf));
return 1; lua_pushstring(L, buf);
}
return 1;
/*** }
Get value for rpg_phaserdmg as number.
@function integer /***
@param name Cvar name. Get value for rpg_phaserdmg as number.
@return Value for rpg_phaserdmg as number. @function integer
*/ @param name Cvar name.
static int Cvar_rpg_phaserdmg(lua_State *L) { @return Value for rpg_phaserdmg as number.
lua_pushnumber(L, (rpg_dmgFlags.integer & 1)); */
static int Cvar_rpg_phaserdmg(lua_State *L) {
return 1; lua_pushnumber(L, (rpg_dmgFlags.integer & 1));
}
return 1;
static const luaL_Reg lib_cvar[] = { }
{ "Integer", Cvar_Integer },
{ "Value", Cvar_Value }, static const luaL_Reg lib_cvar[] = {
{ "String", Cvar_String }, { "Integer", Cvar_Integer },
{ "rpg_phaserdmg", Cvar_rpg_phaserdmg }, // cvar does not exist anymore ... modified function to return the correct information for convinience { "Value", Cvar_Value },
{ NULL, NULL} { "String", Cvar_String },
}; { "rpg_phaserdmg", Cvar_rpg_phaserdmg }, // cvar does not exist anymore ... modified function to return the correct information for convinience
{ NULL, NULL}
int Luaopen_Cvar(lua_State *L) { };
luaL_register(L, "cvar", lib_cvar);
int Luaopen_Cvar(lua_State *L) {
return 1; luaL_register(L, "cvar", lib_cvar);
}
return 1;
}
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,12 @@
// game lib for lua // game lib for lua
#include "g_lua.h" #include "g_lua.h"
#include "g_combat.h"
#ifdef G_LUA #ifdef G_LUA
#include "g_combat.h"
#include "g_syscalls.h"
/*** /***
This module provides access to some of the servers functionality. This module provides access to some of the servers functionality.
@module game @module game

File diff suppressed because it is too large Load diff

View file

@ -1,299 +1,301 @@
// lua library for trace_t // lua library for trace_t
#include "g_lua.h" #include "g_lua.h"
#ifdef G_LUA #ifdef G_LUA
/*** #include "g_syscalls.h"
A module allowing to do traces. Documentation under work.
@module trace /***
*/ A module allowing to do traces. Documentation under work.
@module trace
static int Trace_GC(lua_State * L) */
{
static int Trace_GC(lua_State * L)
return 0; {
}
return 0;
static int Trace_ToString(lua_State * L) }
{
ltrace_t *ltrace; static int Trace_ToString(lua_State * L)
trace_t *trace; {
char buf[MAX_STRING_CHARS]; ltrace_t *ltrace;
trace_t *trace;
ltrace = Lua_GetTrace(L, 1); char buf[MAX_STRING_CHARS];
trace = ltrace->tr;
Com_sprintf(buf, sizeof(buf), "trace: entity=%i fraction=%f allsolid=%i contents=%i endpos=\"%s\" startsolid=%i surfaceFlags=%i pointer=%p\n", ltrace = Lua_GetTrace(L, 1);
trace->entityNum, trace = ltrace->tr;
trace->fraction, Com_sprintf(buf, sizeof(buf), "trace: entity=%i fraction=%f allsolid=%i contents=%i endpos=\"%s\" startsolid=%i surfaceFlags=%i pointer=%p\n",
trace->allsolid, trace->entityNum,
trace->contents, trace->fraction,
vtos(trace->endpos), trace->allsolid,
trace->startsolid, trace->contents,
trace->surfaceFlags, vtos(trace->endpos),
trace); trace->startsolid,
lua_pushstring(L, buf); trace->surfaceFlags,
trace);
return 1; lua_pushstring(L, buf);
}
return 1;
/*** }
Does a trace.
@function DoTrace /***
@param start start-point of the trace. Does a trace.
@param mins minimal distance of trace (nil if unused) @function DoTrace
@param maxs maximal distance of trace (nil if unused) @param start start-point of the trace.
@param end end-point of trace @param mins minimal distance of trace (nil if unused)
@param passEnt Number of ents to pass @param maxs maximal distance of trace (nil if unused)
@param contents Set content flags. @param end end-point of trace
*/ @param passEnt Number of ents to pass
static int Trace_DoTrace(lua_State *L) { @param contents Set content flags.
trace_t *tr; */
vec_t *start, *end, *mins = NULL, *maxs = NULL; static int Trace_DoTrace(lua_State *L) {
int passEnt, contents; trace_t *tr;
vec_t *start, *end, *mins = NULL, *maxs = NULL;
start = Lua_GetVector(L, 1); int passEnt, contents;
if(!lua_isnil(L, 2))
mins = Lua_GetVector(L, 2); start = Lua_GetVector(L, 1);
if(!lua_isnil(L, 3)) if(!lua_isnil(L, 2))
maxs = Lua_GetVector(L, 3); mins = Lua_GetVector(L, 2);
end = Lua_GetVector(L, 4); if(!lua_isnil(L, 3))
passEnt = (int)luaL_checknumber(L, 5); maxs = Lua_GetVector(L, 3);
contents = (int) luaL_checknumber(L, 6); end = Lua_GetVector(L, 4);
passEnt = (int)luaL_checknumber(L, 5);
tr = (trace_t *)malloc(sizeof(trace_t)); contents = (int) luaL_checknumber(L, 6);
if(!tr) {
LUA_DEBUG("Trace_DoTrace - was unable to allocate a trace_t.\n"); tr = (trace_t *)malloc(sizeof(trace_t));
lua_pushnil(L); if(!tr) {
return 1; LUA_DEBUG("Trace_DoTrace - was unable to allocate a trace_t.\n");
} lua_pushnil(L);
return 1;
trap_Trace(tr, start, mins, maxs, end, passEnt, contents); }
Lua_PushTrace(L, tr); trap_Trace(tr, start, mins, maxs, end, passEnt, contents);
return 1; Lua_PushTrace(L, tr);
}
return 1;
/*** }
Frees all memory that was allocated for this trace.
@function FreeTrace /***
@param trace The trace. Frees all memory that was allocated for this trace.
*/ @function FreeTrace
static int Trace_FreeTrace(lua_State *L) { @param trace The trace.
ltrace_t *tr; */
static int Trace_FreeTrace(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
if(tr && tr->tr)
free(tr->tr); tr = Lua_GetTrace(L, 1);
if(tr && tr->tr)
return 1; free(tr->tr);
}
return 1;
/*** }
Check whether the trace has gone only trough solid content (e.g. only inside a wall).
@function GetAllsolid /***
@return Whether trace was all solid. Check whether the trace has gone only trough solid content (e.g. only inside a wall).
*/ @function GetAllsolid
static int Trace_GetAllsolid(lua_State *L) { @return Whether trace was all solid.
ltrace_t *tr; */
static int Trace_GetAllsolid(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushboolean(L, (int)tr->tr->allsolid);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushboolean(L, (int)tr->tr->allsolid);
}
return 1;
/*** }
Check whether the trace has started in solid contents.
@function GetStartsolid /***
@return Whether trace started solid. Check whether the trace has started in solid contents.
*/ @function GetStartsolid
static int Trace_GetStartsolid(lua_State *L) { @return Whether trace started solid.
ltrace_t *tr; */
static int Trace_GetStartsolid(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushboolean(L, (int)tr->tr->startsolid);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushboolean(L, (int)tr->tr->startsolid);
}
return 1;
/*** }
Get fraction of trace.
@function GetFraction /***
@return Fraction. Get fraction of trace.
*/ @function GetFraction
static int Trace_GetFraction(lua_State *L) { @return Fraction.
ltrace_t *tr; */
static int Trace_GetFraction(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushnumber(L, tr->tr->fraction);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushnumber(L, tr->tr->fraction);
}
return 1;
/*** }
Get end position of the trace.
@function GetEndpos /***
@return End position of the trace. Get end position of the trace.
*/ @function GetEndpos
static int Trace_GetEndpos(lua_State *L) { @return End position of the trace.
ltrace_t *tr; */
static int Trace_GetEndpos(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
Lua_PushVector(L, tr->tr->endpos);
tr = Lua_GetTrace(L, 1);
return 1; Lua_PushVector(L, tr->tr->endpos);
}
return 1;
/*** }
Get the surface flags for the face the trace hit.
@function GetSurfaceFlags /***
@return Surface flags. Get the surface flags for the face the trace hit.
*/ @function GetSurfaceFlags
static int Trace_GetSurfaceFlags(lua_State *L) { @return Surface flags.
ltrace_t *tr; */
static int Trace_GetSurfaceFlags(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushnumber(L, tr->tr->surfaceFlags);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushnumber(L, tr->tr->surfaceFlags);
}
return 1;
/*** }
Get content flags for the trace.
@function GetContents /***
@return Content flags. Get content flags for the trace.
*/ @function GetContents
static int Trace_GetContents(lua_State *L) { @return Content flags.
ltrace_t *tr; */
static int Trace_GetContents(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushnumber(L, tr->tr->contents);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushnumber(L, tr->tr->contents);
}
return 1;
/*** }
Get entity number for entity the trace hit.
@function GetEntityNum /***
@return Entity number. Get entity number for entity the trace hit.
*/ @function GetEntityNum
static int Trace_GetEntityNum(lua_State *L) { @return Entity number.
ltrace_t *tr; */
static int Trace_GetEntityNum(lua_State *L) {
tr = Lua_GetTrace(L, 1); ltrace_t *tr;
lua_pushnumber(L, tr->tr->entityNum);
tr = Lua_GetTrace(L, 1);
return 1; lua_pushnumber(L, tr->tr->entityNum);
}
return 1;
/*** }
Get entity the trace hit.
@function GetEntity /***
@return entity the trace hit. Get entity the trace hit.
*/ @function GetEntity
static int Trace_GetEntity(lua_State *L) { @return entity the trace hit.
ltrace_t *tr; */
gentity_t *ent; static int Trace_GetEntity(lua_State *L) {
ltrace_t *tr;
tr = Lua_GetTrace(L, 1); gentity_t *ent;
ent = &g_entities[tr->tr->entityNum];
Lua_PushEntity(L, ent); tr = Lua_GetTrace(L, 1);
ent = &g_entities[tr->tr->entityNum];
return 1; Lua_PushEntity(L, ent);
}
return 1;
static const luaL_Reg lib_trace[] = { }
{ "DoTrace", Trace_DoTrace },
{ "FreeTrace", Trace_FreeTrace }, static const luaL_Reg lib_trace[] = {
{ NULL, NULL } { "DoTrace", Trace_DoTrace },
}; { "FreeTrace", Trace_FreeTrace },
{ NULL, NULL }
static const luaL_Reg Trace_meta[] = { };
{ "__gc", Trace_GC },
{ "__tostring", Trace_ToString }, static const luaL_Reg Trace_meta[] = {
{ "GetAllsolid", Trace_GetAllsolid }, { "__gc", Trace_GC },
{ "GetStartsolid", Trace_GetStartsolid }, { "__tostring", Trace_ToString },
{ "GetFraction", Trace_GetFraction }, { "GetAllsolid", Trace_GetAllsolid },
{ "GetEndpos", Trace_GetEndpos }, { "GetStartsolid", Trace_GetStartsolid },
{ "GetSurfaceFlags", Trace_GetSurfaceFlags }, { "GetFraction", Trace_GetFraction },
{ "GetContents", Trace_GetContents }, { "GetEndpos", Trace_GetEndpos },
{ "GetEntityNum", Trace_GetEntityNum }, { "GetSurfaceFlags", Trace_GetSurfaceFlags },
{ "GetEntity", Trace_GetEntity }, { "GetContents", Trace_GetContents },
{ NULL, NULL } { "GetEntityNum", Trace_GetEntityNum },
}; { "GetEntity", Trace_GetEntity },
{ NULL, NULL }
int Luaopen_Trace(lua_State *L) { };
luaL_newmetatable(L, "game.trace");
int Luaopen_Trace(lua_State *L) {
lua_pushstring(L, "__index"); luaL_newmetatable(L, "game.trace");
lua_pushvalue(L, -2);
lua_settable(L, -3); lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
luaL_register(L, NULL, Trace_meta); lua_settable(L, -3);
luaL_register(L, "trace", lib_trace);
luaL_register(L, NULL, Trace_meta);
/* Add constants */ luaL_register(L, "trace", lib_trace);
lua_pushstring(L, "CONSTANTS");
lua_newtable(L); /* Add constants */
Lua_RegConstInteger(L, CONTENTS_NONE); lua_pushstring(L, "CONSTANTS");
Lua_RegConstInteger(L, CONTENTS_SOLID); lua_newtable(L);
Lua_RegConstInteger(L, CONTENTS_LAVA); Lua_RegConstInteger(L, CONTENTS_NONE);
Lua_RegConstInteger(L, CONTENTS_SLIME); Lua_RegConstInteger(L, CONTENTS_SOLID);
Lua_RegConstInteger(L, CONTENTS_WATER); Lua_RegConstInteger(L, CONTENTS_LAVA);
Lua_RegConstInteger(L, CONTENTS_FOG); Lua_RegConstInteger(L, CONTENTS_SLIME);
Lua_RegConstInteger(L, CONTENTS_LADDER); Lua_RegConstInteger(L, CONTENTS_WATER);
Lua_RegConstInteger(L, CONTENTS_AREAPORTAL); Lua_RegConstInteger(L, CONTENTS_FOG);
Lua_RegConstInteger(L, CONTENTS_PLAYERCLIP); Lua_RegConstInteger(L, CONTENTS_LADDER);
Lua_RegConstInteger(L, CONTENTS_MONSTERCLIP); Lua_RegConstInteger(L, CONTENTS_AREAPORTAL);
Lua_RegConstInteger(L, CONTENTS_SHOTCLIP); Lua_RegConstInteger(L, CONTENTS_PLAYERCLIP);
Lua_RegConstInteger(L, CONTENTS_TELEPORTER); Lua_RegConstInteger(L, CONTENTS_MONSTERCLIP);
Lua_RegConstInteger(L, CONTENTS_JUMPPAD); Lua_RegConstInteger(L, CONTENTS_SHOTCLIP);
Lua_RegConstInteger(L, CONTENTS_ITEM); Lua_RegConstInteger(L, CONTENTS_TELEPORTER);
Lua_RegConstInteger(L, CONTENTS_CLUSTERPORTAL); Lua_RegConstInteger(L, CONTENTS_JUMPPAD);
Lua_RegConstInteger(L, CONTENTS_DONOTENTER); Lua_RegConstInteger(L, CONTENTS_ITEM);
Lua_RegConstInteger(L, CONTENTS_BOTCLIP); Lua_RegConstInteger(L, CONTENTS_CLUSTERPORTAL);
Lua_RegConstInteger(L, CONTENTS_ORIGIN); Lua_RegConstInteger(L, CONTENTS_DONOTENTER);
Lua_RegConstInteger(L, CONTENTS_BODY); Lua_RegConstInteger(L, CONTENTS_BOTCLIP);
Lua_RegConstInteger(L, CONTENTS_CORPSE); Lua_RegConstInteger(L, CONTENTS_ORIGIN);
Lua_RegConstInteger(L, CONTENTS_DETAIL); Lua_RegConstInteger(L, CONTENTS_BODY);
Lua_RegConstInteger(L, CONTENTS_STRUCTURAL); Lua_RegConstInteger(L, CONTENTS_CORPSE);
Lua_RegConstInteger(L, CONTENTS_TRANSLUCENT); Lua_RegConstInteger(L, CONTENTS_DETAIL);
Lua_RegConstInteger(L, CONTENTS_TRIGGER); Lua_RegConstInteger(L, CONTENTS_STRUCTURAL);
Lua_RegConstInteger(L, CONTENTS_NODROP); Lua_RegConstInteger(L, CONTENTS_TRANSLUCENT);
Lua_RegConstInteger(L, MASK_ALL); Lua_RegConstInteger(L, CONTENTS_TRIGGER);
Lua_RegConstInteger(L, MASK_SOLID); Lua_RegConstInteger(L, CONTENTS_NODROP);
Lua_RegConstInteger(L, MASK_PLAYERSOLID); Lua_RegConstInteger(L, MASK_ALL);
Lua_RegConstInteger(L, MASK_DEADSOLID); Lua_RegConstInteger(L, MASK_SOLID);
Lua_RegConstInteger(L, MASK_WATER); Lua_RegConstInteger(L, MASK_PLAYERSOLID);
Lua_RegConstInteger(L, MASK_OPAQUE); Lua_RegConstInteger(L, MASK_DEADSOLID);
Lua_RegConstInteger(L, MASK_SHOT); Lua_RegConstInteger(L, MASK_WATER);
Lua_RegConstInteger(L, MASK_ONLYPLAYER); Lua_RegConstInteger(L, MASK_OPAQUE);
Lua_RegConstInteger(L, MASK_BRUSHES); Lua_RegConstInteger(L, MASK_SHOT);
lua_settable(L, -3); Lua_RegConstInteger(L, MASK_ONLYPLAYER);
Lua_RegConstInteger(L, MASK_BRUSHES);
return 1; lua_settable(L, -3);
}
return 1;
void Lua_PushTrace(lua_State * L, trace_t * tr) }
{
ltrace_t *trace; void Lua_PushTrace(lua_State * L, trace_t * tr)
{
trace = (ltrace_t *)lua_newuserdata(L, sizeof(ltrace_t)); ltrace_t *trace;
luaL_getmetatable(L, "game.trace"); trace = (ltrace_t *)lua_newuserdata(L, sizeof(ltrace_t));
lua_setmetatable(L, -2);
luaL_getmetatable(L, "game.trace");
trace->tr = tr; lua_setmetatable(L, -2);
}
trace->tr = tr;
ltrace_t *Lua_GetTrace(lua_State * L, int argNum) }
{
void *ud; ltrace_t *Lua_GetTrace(lua_State * L, int argNum)
{
ud = luaL_checkudata(L, argNum, "game.trace"); void *ud;
luaL_argcheck(L, ud != NULL, argNum, "\'trace\' expected");
return (ltrace_t *) ud; ud = luaL_checkudata(L, argNum, "game.trace");
} luaL_argcheck(L, ud != NULL, argNum, "\'trace\' expected");
#endif return (ltrace_t *) ud;
}
#endif