Skip to content

Commit

Permalink
fix kaas compiler errors
Browse files Browse the repository at this point in the history
removed kaas prefix
renamed kaas vector names to suit kpq3 naming
updated wep lerp
hmg timmer changed
fixed team bonus crash. in dm
added HD suport for md3 vertex position(dynamic grid)
  • Loading branch information
hypov8 committed Apr 14, 2024
1 parent 53db807 commit d614b8f
Show file tree
Hide file tree
Showing 58 changed files with 580 additions and 493 deletions.
6 changes: 3 additions & 3 deletions code/botlib/be_aas_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* $Archive: /source/code/botlib/be_aas_cluster.h $
*
*****************************************************************************/
#ifndef BE_AAS_CLUSTER_H_
#ifndef BE_AAS_CLUSTER_H_
#define BE_AAS_CLUSTER_H_
#ifdef AASINTERN
//initialize the AAS clustering
Expand All @@ -38,5 +38,5 @@ void AAS_InitClustering(void);
void AAS_SetViewPortalsAsClusterPortals(void);
#endif //AASINTERN
void AAS_InitClustering(void);
#endif

#endif
4 changes: 2 additions & 2 deletions code/botlib/be_aas_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ typedef struct aas_s
float time;
int numframes;
//name of the aas file
char filename[MAX_PATH];
char mapname[MAX_PATH];
char *filename; // [MAX_PATH];
char *mapname; // [MAX_PATH];
//bounding boxes
int numbboxes;
aas_bbox_t *bboxes;
Expand Down
2 changes: 1 addition & 1 deletion code/botlib/be_aas_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void AAS_UnlinkInvalidEntities(void);
//resets the entity AAS and BSP links (sets areas and leaves pointers to NULL)
void AAS_ResetEntityLinks(void);
//updates an entity
#ifndef BSPC
#if 1 //ndef BSPC
int AAS_UpdateEntity(int ent, bot_entitystate_t *state);
//gives the entity data used for collision detection
void AAS_EntityBSPData(int entnum, bsp_entdata_t *entdata);
Expand Down
2 changes: 1 addition & 1 deletion code/botlib/be_aas_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/

#if 1 //ndef BSPCINCLUDE
#ifndef BSPCINCLUDE

#include "be_aas_main.h"
#include "be_aas_entity.h"
Expand Down
4 changes: 2 additions & 2 deletions code/botlib/be_aas_reach.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3593,7 +3593,7 @@ void AAS_Reachability_JumpPad(void)
botimport.Print(PRT_MESSAGE, "absmaxs = %f %f %f\n", absmaxs[0], absmaxs[1], absmaxs[2]);
#endif REACH_DEBUG
VectorAdd(absmins, absmaxs, origin);
Vec3_Scale (origin, 0.5, origin);
VectorScale (origin, 0.5, origin);
//get the start areas
VectorCopy(origin, teststart);
Expand Down Expand Up @@ -3635,7 +3635,7 @@ void AAS_Reachability_JumpPad(void)
continue;
} //end if
// set s.origin2 to the push velocity
Vec3_Subtract ( ent2origin, origin, velocity);
VectorSubtract ( ent2origin, origin, velocity);
dist = VectorNormalize( velocity);
forward = dist / time;
//FIXME: why multiply by 1.1
Expand Down
5 changes: 3 additions & 2 deletions code/botlib/be_aas_sample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ qboolean AAS_InsideFace(aas_face_t *face, vec3_t pnormal, vec3_t point, float ep
//this is done by checking the sign of the dot product of the
//vector orthogonal vector from above and the vector from the
//origin (first vertex of edge) to the point
//if the Vec3_DotProduct is smaller than zero the point is outside the face
//if the DotProduct is smaller than zero the point is outside the face
if (DotProduct(pointvec, sepnormal) < -epsilon) return qfalse;
} //end for
return qtrue;
Expand Down Expand Up @@ -1395,7 +1395,8 @@ int AAS_AreaInfo( int areanum, aas_areainfo_t *info )
//===========================================================================
aas_plane_t *AAS_PlaneFromNum(int planenum)
{
if (!aasworld.loaded) return NULL;
if (!aasworld.loaded)
return NULL;

return &aasworld.planes[planenum];
} //end of the function AAS_PlaneFromNum
8 changes: 6 additions & 2 deletions code/botlib/l_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ void *GetHunkMemoryDebug(unsigned long size, char *label, char *file, int line);
void *GetClearedHunkMemoryDebug(unsigned long size, char *label, char *file, int line);
#else

//
#ifdef BSPC
//allocate a memory block of the given size
void *GetMemory(size_t size);
//allocate a memory block of the given size and clear it
void *GetClearedMemory(size_t size);
//
#define GetHunkMemory GetMemory
//#define GetClearedHunkMemory GetClearedMemory
#define GetClearedHunkMemory GetClearedMemory
#else
//allocate a memory block of the given size
void *GetMemory(unsigned long size);
Expand Down
7 changes: 1 addition & 6 deletions code/botlib/l_precomp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ typedef enum {qfalse, qtrue} qboolean;
#include "../kaas/qbsp.h"
#include "../kaas/l_log.h"
#include "../kaas/l_mem.h"
/////////////#include "../kaas/be_aas_bspc.h"
#include "../botlib/l_precomp.h"
//#include "../botlib/l_utils.h" //hypov8 add
//#include "../qcommon/q_shared.h"

#include "../botlib/be_aas_main.h"

//typedef enum {qfalse, qtrue} qboolean;
//#define qtrue true
Expand Down Expand Up @@ -1040,7 +1035,7 @@ int PC_Directive_include(source_t *source)
{
script_t *script;
token_t token;
char path[MAX_PATH] = "";
char path[2*MAX_PATH] = "";
#ifdef QUAKE
foundfile_t file;
#endif //QUAKE
Expand Down
9 changes: 6 additions & 3 deletions code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,14 +944,17 @@ void CG_EntityEvent(centity_t *cent, vec3_t position)
DEBUGNAME("EV_FIRE_SHOTGUN");
CG_FireWeapon(cent, qfalse);
break;
case EV_FIRE_SPISTOL:
case EV_FIRE_SPISTOL:
DEBUGNAME("EV_FIRE_SPISTOL");
CG_FireWeapon(cent, qtrue);
break;
case EV_FIRE_HMG_SHOT: //hypov8 todo: cleanup. not used anymore
/*case EV_FIRE_HMG_SHOT: //hypov8 todo: cleanup. not used anymore
DEBUGNAME("EV_FIRE_HMG_SHOT");
CG_FireWeapon(cent, qfalse);
break;
break;*/
/*case EV_FIRE_COOLDOWN:
//todo
break;*/
case EV_RELOAD_WEAPON:
DEBUGNAME("EV_RELOAD_WEAPON");
CG_ReloadWeapon(cent);
Expand Down
42 changes: 21 additions & 21 deletions code/cgame/cg_playerstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,27 @@ hypov8 view recoil for 1st person
*/
void CG_ShootFeedback(int weaponUsed)
{
float kick;
int timeAdd;

switch (weaponUsed)
{
case WP_CROWBAR: timeAdd = WP_TIME_FIRE_CROWBAR / 2; kick = 1; break;
case WP_PISTOL: timeAdd = WP_TIME_FIRE_PISTOL / 2; kick = 2.5; break;
case WP_SHOTGUN: timeAdd = WP_TIME_FIRE_SHOTGUN / 2; kick = 4; break;
case WP_MACHINEGUN: timeAdd = WP_TIME_FIRE_MACHINEGUN / 2; kick = 0.5f; break;
case WP_GRENADE_LAUNCHER: timeAdd = WP_TIME_FIRE_GRENADE_LAUNCHER / 2; kick = 5; break;
case WP_ROCKET_LAUNCHER: timeAdd = WP_TIME_FIRE_ROCKET_LAUNCHER / 2; kick = 5; break;
case WP_HMG: timeAdd = WP_TIME_FIRE_HMG /2; kick = 1.5; break;
case WP_FLAMER: timeAdd = WP_TIME_FIRE_FLAMEGUN / 2; kick = 0.2f; break;
default: timeAdd = 0; kick = 0; break;
}

cg.v_dmg_roll = (float)(((rand() / (float)RAND_MAX) * 1.0 - 0.5));
cg.v_dmg_pitch = -kick;
cg.v_dmg_time = cg.time + timeAdd;

cg.damageTime = cg.snap->serverTime;
float kick;
int timeAdd;

switch (weaponUsed)
{
case WP_CROWBAR: timeAdd = WP_TIME_FIRE_CROWBAR / 2; kick = 1; break;
case WP_PISTOL: timeAdd = WP_TIME_FIRE_PISTOL / 2; kick = 2.5; break;
case WP_SHOTGUN: timeAdd = WP_TIME_FIRE_SHOTGUN / 2; kick = 4; break;
case WP_MACHINEGUN: timeAdd = WP_TIME_FIRE_MACHINEGUN / 2; kick = 0.5f; break;
case WP_GRENADE_LAUNCHER: timeAdd = WP_TIME_FIRE_GRENADE_LAUNCHER / 2; kick = 5; break;
case WP_ROCKET_LAUNCHER: timeAdd = WP_TIME_FIRE_ROCKET_LAUNCHER / 2; kick = 5; break;
case WP_HMG: timeAdd = WP_TIME_FIRE_HMG_3RD / 3; kick = 1.5; break;
case WP_FLAMER: timeAdd = WP_TIME_FIRE_FLAMEGUN / 2; kick = 0.2f; break;
default: timeAdd = 0; kick = 0; break;
}

cg.v_dmg_roll = (float)(((rand() / (float)RAND_MAX) * 1.0 - 0.5));
cg.v_dmg_pitch = -kick;
cg.v_dmg_time = cg.time + timeAdd;

cg.damageTime = cg.snap->serverTime;
}


Expand Down
85 changes: 48 additions & 37 deletions code/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ static int CG_WeaponFireTimeOffset(int weaponIndex)
case WP_ROCKET_LAUNCHER:
return WP_TIME_FIRE_ROCKET_LAUNCHER;
case WP_HMG:
return WP_TIME_FIRE_HMG_LAST;
return WP_TIME_FIRE_HMG_FULL;
#ifdef USE_FLAMEGUN
case WP_FLAMER:
return WP_TIME_FIRE_FLAMEGUN;
Expand All @@ -704,6 +704,18 @@ static int CG_WeaponFireTimeOffset(int weaponIndex)
return WP_TIME_FIRE_GRAPPLING_HOOK;
}
}
//
/*static int CG_WeaponFireTimeOffset_mod(int weaponIndex)
{
switch (weaponIndex)
{
case WP_HMG:
return WP_TIME_FIRE_HMG_LAST;
default:
return WP_TIME_RELOAD_PISTOL;
}
}*/

/*
================
Expand Down Expand Up @@ -757,12 +769,12 @@ static qboolean CG_ParseWeaponAnimationFile(const char *filename, animation_t *a
float fps;
char text[1024];
fileHandle_t f;
int maxWepStates = WEAPON_RELOAD_MOD;
int maxWepStates = MAX_WEAPON_STATES;

if ( weaponNum == WP_SHOTGUN || weaponNum == WP_CROWBAR )
maxWepStates = MAX_WEAPON_STATES; //hypov8 todo: add WEAPON_MOD to all animation.cfg
//if ( weaponNum == WP_SHOTGUN || weaponNum == WP_CROWBAR )
// maxWepStates = MAX_WEAPON_STATES; //hypov8 todo: add WEAPON_MOD to all animation.cfg

Com_Memset(animations, 0, sizeof(animation_t) * MAX_WEAPON_STATES);
Com_Memset(animations, 0, sizeof(animation_t) * maxWepStates);

if (cg_debugWeaponAnim.integer)
Com_Printf("loading animation file: %s\n", filename);
Expand Down Expand Up @@ -827,42 +839,41 @@ static qboolean CG_ParseWeaponAnimationFile(const char *filename, animation_t *a
fps = 15;
}

//add hypov8 sync animation using a #defined total animation time in engine, not animation.cfg
//this allows the complete animation sequence to run in the set timeframe
if (ws == WEAPON_RELOADING && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = floor(CG_WeaponReloadTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponReloadTimeOffset(weaponNum) / animations[ws].numFrames);
}
else if (ws == WEAPON_RELOAD_MOD && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = floor(CG_WeaponModTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponModTimeOffset(weaponNum) / animations[ws].numFrames);
}
else if (ws == WEAPON_FIRING && animations[ws].numFrames > 0)
{
if (animations[ws].loopFrames == 0)
//add hypov8 sync animation using a #defined total animation time in engine, not animation.cfg
//this allows the complete animation sequence to run in the set timeframe
if (ws == WEAPON_RELOADING && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = floor(CG_WeaponFireTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponFireTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].frameLerp = floor(CG_WeaponReloadTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponReloadTimeOffset(weaponNum) / animations[ws].numFrames);
}
else //hypov8 allow looping. use fps. adds variance to fast fire weapons (tommy/flamer)
else if (ws == WEAPON_RELOAD_MOD && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = 1000 / fps;
animations[ws].frameLerp = floor(CG_WeaponModTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponModTimeOffset(weaponNum) / animations[ws].numFrames);
}
else if (ws == WEAPON_FIRING && animations[ws].numFrames > 0)
{
if (animations[ws].loopFrames == 0)
{
animations[ws].frameLerp = floor(CG_WeaponFireTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponFireTimeOffset(weaponNum) / animations[ws].numFrames);
}
else //hypov8 allow looping. use fps. adds variance to fast fire weapons (tommy/flamer)
{
animations[ws].frameLerp = 1000 / fps;
animations[ws].initialLerp = 1000 / fps;
}
}
else if ((ws == WEAPON_DROPPING || ws == WEAPON_RAISING) && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = floor(CG_WeaponChangeTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponChangeTimeOffset(weaponNum) / animations[ws].numFrames);
}
else //WEAPON_READY
{
animations[ws].frameLerp = 1000 / fps;
animations[ws].initialLerp = 1000 / fps;
}
}
else if ((ws == WEAPON_DROPPING || ws == WEAPON_RAISING) && animations[ws].numFrames > 0)
{
animations[ws].frameLerp = floor(CG_WeaponChangeTimeOffset(weaponNum) / animations[ws].numFrames);
animations[ws].initialLerp = floor(CG_WeaponChangeTimeOffset(weaponNum) / animations[ws].numFrames);
}
else //WEAPON_READY
{
animations[ws].frameLerp = 1000 / fps;
animations[ws].initialLerp = 1000 / fps;
}


if (cg_debugWeaponAnim.integer)
Com_Printf(S_COLOR_WHITE"Mode %d: %d %d %d %f\n", ws, animations[ws].firstFrame, animations[ws].numFrames, animations[ws].loopFrames , fps );
Expand Down Expand Up @@ -1383,7 +1394,7 @@ static int CG_MapTorsoToWeaponFrame(clientInfo_t *ci, int frame, int anim, int w
}
else if (anim == TORSO_RAISE && frame < 9)
{
return frame + weapon->animations[WEAPON_RAISING].firstFrame;;
return frame + weapon->animations[WEAPON_RAISING].firstFrame;
}
else if ((anim == TORSO_ATTACK || anim == TORSO_ATTACK2 || anim == TORSO_ATTACK3)) // stand attack
{
Expand Down
3 changes: 2 additions & 1 deletion code/game/ai_dmq3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6334,7 +6334,8 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state)
//FIXME: either add to sound queue or mark player as someone making noise
case EV_FIRE_SHOTGUN:// add hypov8
case EV_FIRE_SPISTOL: //add hypov8
case EV_FIRE_HMG_SHOT:
//case EV_FIRE_HMG_SHOT:
//case EV_FIRE_COOLDOWN:
break;
case EV_USE_ITEM0:
case EV_USE_ITEM1:
Expand Down
4 changes: 2 additions & 2 deletions code/game/bg_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ gitem_t bg_itemlist[] =
"", // precache
"" // sounds
},

//hypov8: not loading? also add reload mod?
/*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) suspended 5 */
{
"item_health_mega",
"item_health_mega",
"sound/world/pickups/health.ogg", /* 0xA5EA */
{
"models/pu_icon/adrenaline/tris.md3",
Expand Down
Loading

0 comments on commit d614b8f

Please sign in to comment.