Skip to content

Instantly share code, notes, and snippets.

@pollend
Created March 20, 2024 04:05
Show Gist options
  • Save pollend/fa8f8a4f94cdd200d3539eb8050a6b1f to your computer and use it in GitHub Desktop.
Save pollend/fa8f8a4f94cdd200d3539eb8050a6b1f to your computer and use it in GitHub Desktop.
diff --git a/source/cgame/cg_players.cpp b/source/cgame/cg_players.cpp
index a1aeba8c6..8a9589546 100644
--- a/source/cgame/cg_players.cpp
+++ b/source/cgame/cg_players.cpp
@@ -270,7 +270,6 @@ void CG_LoadClientInfo( cg_clientInfo_t *ci, const char *info, int client )
s = Info_ValueForKey( info, "m" );
ci->modelindex = s && s[0] ? atoi( s ) : 0;
-
s = Info_ValueForKey( info, "steam_id" );
if (s && atol(s)){
ci->steamid = atoll(s);
@@ -280,8 +279,10 @@ void CG_LoadClientInfo( cg_clientInfo_t *ci, const char *info, int client )
void CG_CallbackRequestAvatar(uint64_t steamid, char *avatar){
for (int i = 0; i < gs.maxclients; i++){
cg_clientInfo_t *ci = &cgs.clientInfo[i];
- if (ci->steamid == steamid){
- ci->avatar = trap_R_RegisterRawPic(va("avatar-%llu", ci->steamid), 32, 32, (uint8_t*)avatar, 4);
+ if (ci->steamid == steamid ){
+ ci->avatar = trap_R_RegisterRawPic(va("avatar-%lu", ci->steamid), 32, 32, (uint8_t*)avatar, 4);
+ printf("%lu %lu\n", (uint64_t)ci->avatar, ci->steamid);
+ assert(ci->avatar);
return;
}
}
diff --git a/source/cgame/cg_scoreboard.cpp b/source/cgame/cg_scoreboard.cpp
index 0edde4141..5c737cdad 100644
--- a/source/cgame/cg_scoreboard.cpp
+++ b/source/cgame/cg_scoreboard.cpp
@@ -801,8 +801,9 @@ static int SCR_DrawPlayerTab( const char **ptrptr, int team, int x, int y, int p
trans = true;
i = -1 - i;
}
- if (i >= 0 && i < gs.maxclients && cgs.clientInfo[i].steamid)
+ if (i >= 0 && i < gs.maxclients && cgs.clientInfo[i].steamid) {
avatar = cgs.clientInfo[i].avatar;
+ }
width = 32;
break;
}
diff --git a/source/qcommon/common.c b/source/qcommon/common.c
index 92643e8cb..135a10cba 100644
--- a/source/qcommon/common.c
+++ b/source/qcommon/common.c
@@ -231,6 +231,8 @@ void Com_Printf( const char *format, ... )
Q_vsnprintfz( msg, sizeof( msg ), format, argptr );
va_end( argptr );
+ printf("%s\n", msg);
+
QMutex_Lock( com_print_mutex );
if( rd_target )
diff --git a/source/ref_gl/r_image.c b/source/ref_gl/r_image.c
index 79c7346c5..31c4bc687 100644
--- a/source/ref_gl/r_image.c
+++ b/source/ref_gl/r_image.c
@@ -1711,11 +1711,13 @@ static image_t *R_CreateImage( const char *name, int width, int height, int laye
return image;
}
+#include <pthread.h>
/*
* R_LoadImage
*/
image_t *R_LoadImage( const char *name, uint8_t **pic, int width, int height, int flags, int minmipsize, int tags, int samples )
{
+
image_t *image;
image = R_CreateImage( name, width, height, 1, flags, minmipsize, tags, samples );
@@ -1724,6 +1726,10 @@ image_t *R_LoadImage( const char *name, uint8_t **pic, int width, int height, in
R_Upload32( QGL_CONTEXT_MAIN, pic, 0, 0, 0, width, height, flags, minmipsize,
&image->upload_width, &image->upload_height, image->samples, false, false );
+
+ R_DeferDataSync();
+
+ R_UnbindImage(image);
return image;
}
@@ -1820,6 +1826,8 @@ void R_ReplaceImage( image_t *image, uint8_t **pic, int width, int height, int f
image->minmipsize = minmipsize;
image->samples = samples;
image->registrationSequence = rsh.registrationSequence;
+
+ R_UnbindImage(image);
}
/*
diff --git a/source/ref_gl/r_shader.c b/source/ref_gl/r_shader.c
index 7063bf1ef..1a2fb562e 100644
--- a/source/ref_gl/r_shader.c
+++ b/source/ref_gl/r_shader.c
@@ -3009,7 +3009,6 @@ shader_t *R_RegisterPic( const char *name )
{
return R_LoadShader( name, SHADER_TYPE_2D, false );
}
-
/*
* R_RegisterRawPic_
*
@@ -3026,7 +3025,6 @@ shader_t *R_RegisterRawPic_( const char *name, int width, int height, uint8_t *d
s = R_LoadShader( name, type, true );
if( s ) {
image_t *image;
-
// unlink and delete the old image from memory, unless it's the default one
image = s->passes[0].images[0];
if( !image || image == rsh.noTexture ) {
diff --git a/source/server/sv_oob.c b/source/server/sv_oob.c
index eff1a546b..f4923836a 100644
--- a/source/server/sv_oob.c
+++ b/source/server/sv_oob.c
@@ -940,6 +940,23 @@ int SVC_FakeConnect( char *fakeUserinfo, char *fakeSocketType, const char *fakeI
// directly call the game begin function
newcl->state = CS_SPAWNED;
+
+ static uint32_t ix = 0;
+
+ uint64_t ids[] = {
+ 76561197969386704,
+ 76561197970258658,
+ 76561197972730962,
+ 76561197977171045,
+ 76561197980379228,
+ 76561197985632015,
+ 76561197999606447,
+ 76561198005297049,
+ 76561198015333844,
+ 76561197996204906
+
+ };
+ ge->ClientAuth( newcl->edict, ids[ (++ix) % Q_ARRAY_COUNT(ids) ] );
ge->ClientBegin( newcl->edict );
return NUM_FOR_EDICT( newcl->edict );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment