Skip to content

Commit

Permalink
Fix entity scan lines per dimension owner
Browse files Browse the repository at this point in the history
  • Loading branch information
TriForceX committed Jun 25, 2024
1 parent db85caf commit a347353
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 23 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ The version control structure on this project is `<mayor>.<minor>.<patch>` where

---

## 0.20.2
- Merge updates from UncannyFish
- Add option to hide time display on motd
- Add alternate toggle option for dual saber
- Add extra check for spectator noclip
- Add visual bars on power converters
- Fix special emotes usage while moving
- Fix entity scan lines per dimension owner

## 0.20.1
- Add optimizations for insta kill mode
- Add dimension skip score tracking
Expand Down
2 changes: 1 addition & 1 deletion code/game/ai_wpnav.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void G_TestLine(vec3_t start, vec3_t end, int color, int time)
{
gentity_t *te;

te = JKMod_G_TempEntity( start, EV_TESTLINE, ENTITYNUM_WORLD); // Tr!Force: [Dimensions] Tag owner info
te = JKMod_G_TempEntity( start, EV_TESTLINE, ENTITYNUM_WORLD ); // Tr!Force: [Dimensions] Tag owner info
VectorCopy(start, te->s.origin);
VectorCopy(end, te->s.origin2);
te->s.time2 = time;
Expand Down
1 change: 0 additions & 1 deletion code/ui/ui_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -2607,7 +2607,6 @@ const char *Item_Multi_Setting(itemDef_t *item) {

// Tr!Force: [UIGeneral] Experimental checkbox behaviour
const char *Item_Checkbox_Setting(itemDef_t *item) {
char buff[2048];
float value = 0;
int i;
multiDef_t *multiPtr = (multiDef_t*)item->typeData;
Expand Down
7 changes: 3 additions & 4 deletions jkmod/game/jk_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ extern int JKModEmotesDataSize;
extern int G_ClientNumberFromName(const char* name);
extern int G_ClientNumberFromStrippedName(const char* name);
extern qboolean G_OtherPlayersDueling(void);
extern void G_TestLine(vec3_t start, vec3_t end, int color, int time);

/*
=====================================================================
Expand Down Expand Up @@ -1699,7 +1698,7 @@ static void JKMod_Cmd_EntityScan(gentity_t *ent, int distance, int boxdelay, int
char found_angles[20];
char found_origin[40];

G_TestLine(orig, dest, 255, linedelay);
JKMod_G_TestLine(orig, dest, 255, linedelay, ent->s.number);

if (!found->inuse) return;

Expand All @@ -1722,11 +1721,11 @@ static void JKMod_Cmd_EntityScan(gentity_t *ent, int distance, int boxdelay, int
found->spawnflags,
found_maxs));

JKMod_DrawBoxLines(found->s.origin, found->r.mins, found->r.maxs, 255, boxdelay);
JKMod_DrawBoxLines(found->s.origin, found->r.mins, found->r.maxs, 255, boxdelay, ent->s.number);
return;
}

G_TestLine(orig, dest, 0, linedelay);
JKMod_G_TestLine(orig, dest, 0, linedelay, ent->s.number);
return;
}

Expand Down
3 changes: 2 additions & 1 deletion jkmod/game/jk_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ qboolean JKMod_ValidPlayerModel(const char* modelname);
void JKMod_ChairModelDisable(gentity_t *ent);

// jk_utils.c
void JKMod_DrawBoxLines(vec3_t orig, vec3_t mins, vec3_t maxs, int color, int duration);
void JKMod_DrawBoxLines(vec3_t orig, vec3_t mins, vec3_t maxs, int color, int duration, int dimensionOwner);
qboolean JKMod_OthersInBox(gentity_t *ent);
void JKMod_AntiStuckBox(gentity_t *ent);
qboolean JKMod_CheckSolid(gentity_t* ent, int distance, vec3_t mins, vec3_t maxs, qboolean elevation);
Expand All @@ -642,6 +642,7 @@ gentity_t *JKMod_G_TempEntity(const vec3_t origin, entity_event_t event, int dim
gentity_t *JKMod_G_SoundTempEntity(const vec3_t origin, int event, int channel, int dimensionOwner);
gentity_t *JKMod_G_PreDefSound(vec3_t org, pdSounds_t pdSound, int dimensionOwner);
void JKMod_G_SoundAtLoc(vec3_t loc, soundChannel_t channel, int soundIndex, int dimensionOwner);
void JKMod_G_TestLine(vec3_t start, vec3_t end, int color, int time, int dimensionOwner);
gentity_t *JKMod_LaunchItem(gitem_t *item, vec3_t origin, vec3_t velocity, int dimensionOwner);

// jk_session.c
Expand Down
42 changes: 28 additions & 14 deletions jkmod/game/jk_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ By Tr!Force. Work copyrighted (C) with holder attribution 2005 - 2024

#include "../../code/game/g_local.h" // Original header

// Extern stuff
extern void G_TestLine(vec3_t start, vec3_t end, int color, int time);

/*
=====================================================================
Draw box lines (Due clientside: 255 = red, 1 = black, 0 = white)
=====================================================================
*/
void JKMod_DrawBoxLines(vec3_t orig, vec3_t mins, vec3_t maxs, int color, int duration)
void JKMod_DrawBoxLines(vec3_t orig, vec3_t mins, vec3_t maxs, int color, int duration, int dimensionOwner)
{
vec3_t point1, point2, point3, point4;
vec3_t bmins, bmaxs;
Expand Down Expand Up @@ -51,18 +48,18 @@ void JKMod_DrawBoxLines(vec3_t orig, vec3_t mins, vec3_t maxs, int color, int du
//- face
point1[vec[0]] = point2[vec[0]] = point3[vec[0]] = point4[vec[0]] = bmins[vec[0]];

G_TestLine(point1, point2, color, duration);
G_TestLine(point2, point3, color, duration);
G_TestLine(point1, point4, color, duration);
G_TestLine(point4, point3, color, duration);
JKMod_G_TestLine(point1, point2, color, duration, dimensionOwner);
JKMod_G_TestLine(point2, point3, color, duration, dimensionOwner);
JKMod_G_TestLine(point1, point4, color, duration, dimensionOwner);
JKMod_G_TestLine(point4, point3, color, duration, dimensionOwner);

//+ face
point1[vec[0]] = point2[vec[0]] = point3[vec[0]] = point4[vec[0]] = bmaxs[vec[0]];

G_TestLine(point1, point2, color, duration);
G_TestLine(point2, point3, color, duration);
G_TestLine(point1, point4, color, duration);
G_TestLine(point4, point1, color, duration);
JKMod_G_TestLine(point1, point2, color, duration, dimensionOwner);
JKMod_G_TestLine(point2, point3, color, duration, dimensionOwner);
JKMod_G_TestLine(point1, point4, color, duration, dimensionOwner);
JKMod_G_TestLine(point4, point1, color, duration, dimensionOwner);
}
}

Expand Down Expand Up @@ -145,12 +142,12 @@ qboolean JKMod_CheckSolid(gentity_t *ent, int distance, vec3_t mins, vec3_t maxs

if (tr.allsolid || tr.startsolid || tr.fraction != 1.0f)
{
if (developer.integer) JKMod_DrawBoxLines(dest, mins, maxs, 255, 500);
if (developer.integer) JKMod_DrawBoxLines(dest, mins, maxs, 255, 500, ent->s.number);
JKMod_Printf(S_COLOR_YELLOW "Can't spawn here, we are in solid\n");
return qfalse;
}

if (developer.integer) JKMod_DrawBoxLines(dest, mins, maxs, 0, 500);
if (developer.integer) JKMod_DrawBoxLines(dest, mins, maxs, 0, 500, ent->s.number);
return qtrue;
}

Expand Down Expand Up @@ -507,6 +504,23 @@ void JKMod_G_SoundAtLoc(vec3_t loc, soundChannel_t channel, int soundIndex, int
te->s.eventParm = soundIndex;
}

/*
=====================================================================
Test line event with owner info
=====================================================================
*/
void JKMod_G_TestLine(vec3_t start, vec3_t end, int color, int time, int dimensionOwner)
{
gentity_t *te;

te = JKMod_G_TempEntity( start, EV_TESTLINE, dimensionOwner );
VectorCopy(start, te->s.origin);
VectorCopy(end, te->s.origin2);
te->s.time2 = time;
te->s.weapon = color;
te->r.svFlags |= SVF_BROADCAST;
}

/*
=====================================================================
Spawns an item and tosses it forward with owner info
Expand Down
2 changes: 1 addition & 1 deletion jkmod/game/jk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ By Tr!Force. Work copyrighted (C) with holder attribution 2005 - 2024
// Version
#define JK_MAJOR 0
#define JK_MINOR 20
#define JK_PATCH 1
#define JK_PATCH 2

// Public
#define JK_VERSION JK_SHORTNAME " v" STR(JK_MAJOR) "." STR(JK_MINOR) "." STR(JK_PATCH)
Expand Down
1 change: 0 additions & 1 deletion jkmod/ui/jk_ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ Teleports list functions
static char *JKMod_UI_TeleportsList(int index, int *actual)
{
int i, c = 0;
char *title;
*actual = 0;

for (i = 0; i < uiInfo.jkmodInfo.teleportCount; i++)
Expand Down

0 comments on commit a347353

Please sign in to comment.