Skip to content

Commit

Permalink
getSpectatorClient, untested
Browse files Browse the repository at this point in the history
commiting because i have other stuff to work on and it's getting in my way lmao
  • Loading branch information
Defected committed Mar 19, 2021
1 parent 9540504 commit 3c37373
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
Binary file modified bin/codextended.so
Binary file not shown.
1 change: 1 addition & 0 deletions src/inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ extern x##_t x
#define SV_NocPacket xtn_SV_NocPacket
#define GScr_Trace xtn_GScr_Trace
#define PlayerCmd_getPlayerAngles xtn_PlayerCmd_getPlayerAngles
#define PlayerCmd_getSpectatorClient xtn_PlayerCmd_getSpectatorClient
#define sv_reconnectlimit xtn_sv_reconnectlimit
#define g_color_table xtn_g_color_table
#define _ProjectPointOnPlane xtn__ProjectPointOnPlane
Expand Down
10 changes: 10 additions & 0 deletions src/scr_method_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,13 @@ void PlayerCmd_getPlayerAngles(int self) {
VectorCopy((float*)((int)ent->client + POFF_ANGLES), vec);
Scr_AddVector(vec);
}

void PlayerCmd_getSpectatorClient(int self) {
gentity_t *ent = &g_entities[self];

if(ent->client->spectatorClient == -1) {
Scr_AddUndefined();
} else {
Scr_AddEntity(&g_entities[ent->client->spectatorClient]);
}
}
1 change: 1 addition & 0 deletions src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ SCRIPTFUNCTION scriptMethods[] = {
{"setvelocity", PlayerCmd_SetVelocity, 0},
{"getvelocity", PlayerCmd_GetVelocity, 0},
{"getplayerangles", PlayerCmd_getPlayerAngles, 0},
{"getspectatorclient", PlayerCmd_getSpectatorClient, 0},
{"getip", PlayerCmd_getip, 0},
{"ispure", PlayerCmd_ispure, 0},
{"sendconnectionlesspacket", PlayerCmd_SendConnectionlessPacket, 0},
Expand Down
1 change: 1 addition & 0 deletions src/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ void PlayerCmd_useButtonPressedX(int);
void PlayerCmd_SetVelocity(int);
void PlayerCmd_GetVelocity(int);
void PlayerCmd_getPlayerAngles(int);
void PlayerCmd_getSpectatorClient(int);
void PlayerCmd_getip(int);
void PlayerCmd_GetInt(int);
void PlayerCmd_SetInt(int);
Expand Down
4 changes: 2 additions & 2 deletions src/sv_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ void SV_NextDownload_f(client_t *cl) {
#endif
}

void SV_DirectConnect( netadr_t from ) { //UGH something is doing illegible server message if 1 same player is connected and 2nd same player is 999 ping
void SV_DirectConnect( netadr_t from ) {
void (*call)(netadr_t);
#if CODPATCH == 1
*(int*)&call = 0x8085498;
Expand Down Expand Up @@ -661,7 +661,7 @@ void SV_DirectConnect( netadr_t from ) { //UGH something is doing illegible serv
cl = getclient(i);
if(cl->state == CS_FREE)
continue;
if(NET_CompareBaseAdr(from, cl->netchan.remoteAddress) || from.port == cl->netchan.remoteAddress.port ) {
if(NET_CompareBaseAdr(from, cl->netchan.remoteAddress) && cl->netchan.qport == qport) { // Removing qport check fixes 999 illegible server message problem but doesn't allow multiple players with same IP...
cprintf(PRINT_UNDERLINE | PRINT_DEBUG, "Client (%s) is reconnecting\n", NET_AdrToString(from));
if(cl->state > 1)
SV_FreeClient(cl);
Expand Down
1 change: 1 addition & 0 deletions src/symbs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
#define SV_NocPacket xtn_SV_NocPacket
#define GScr_Trace xtn_GScr_Trace
#define PlayerCmd_getPlayerAngles xtn_PlayerCmd_getPlayerAngles
#define PlayerCmd_getSpectatorClient xtn_PlayerCmd_getSpectatorClient
#define sv_reconnectlimit xtn_sv_reconnectlimit
#define g_color_table xtn_g_color_table
#define _ProjectPointOnPlane xtn__ProjectPointOnPlane
Expand Down

0 comments on commit 3c37373

Please sign in to comment.