Skip to content

Commit

Permalink
Merge pull request #60 from Subject9x/patch-2-release-1-1-7
Browse files Browse the repository at this point in the history
Patch 2-release 1.7.9
  • Loading branch information
Subject9x authored Feb 5, 2021
2 parents 68981f9 + 0875dd5 commit 3e412e7
Show file tree
Hide file tree
Showing 135 changed files with 3,140 additions and 2,213 deletions.
169 changes: 101 additions & 68 deletions client/client_main.qc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void() CSQC_Init =
VQSIZE = 6;
SQUED = FALSE;

TQSIZE = 8;
//Radio Transmission queue size
TQSIZE = 4;
TRTIME = 0;
TR_TIME_NEXT = 0;
TQUED = FALSE;
Expand Down Expand Up @@ -114,8 +115,7 @@ void() CSQC_Init =

//clean up mapname global for file use
tokenizebyseparator(mapname, "/", ".");
MAP_NAME = argv(1);
MAP_NAME = strzone(MAP_NAME);
cacheGlobalString( MAP_NAME, argv(1) )

CFG_INDEX = 1;
CFG_INDEX_PREV = CFG_INDEX;
Expand Down Expand Up @@ -151,7 +151,7 @@ void() CSQC_Init =
SCORESTACK = 0;

for( i=0; i < SCOREBOARDMAX; i=i+1){
SCOREBOARD[i] = -1;
SCOREBOARD[i] = -1;
}
scoreboard_think();

Expand All @@ -168,31 +168,54 @@ void() CSQC_Init =
VIEW_OBS_ID = 1;
ui_colors_set_player_list();
ISMENU_PREV = FALSE;

cacheGlobalString( PLAYER_COLOR_PSC, cvar_string("cl_color_psc") )
cacheGlobalString( PLAYER_COLOR_SRV, cvar_string("cl_color_srv") )
cacheGlobalString( PLAYER_COLOR_MIL, cvar_string("cl_color_mil") )

PLAYER_COLOR_PSC = strzone(cvar_string("cl_color_psc"));
PLAYER_COLOR_SRV = strzone(cvar_string("cl_color_srv"));
PLAYER_COLOR_MIL = strzone(cvar_string("cl_color_mil"));

cl_ini_infostring();
};

// called on level shutdown (disconnect, level change, quit, loading a saved game, etc)
void() CSQC_Shutdown =
{
if( UNLOCKED_MECHS_DATA != "" ){
strunzone(UNLOCKED_MECHS_DATA);
}
if( UNLOCKED_ITEMS_DATA != "" ){
strunzone(UNLOCKED_ITEMS_DATA);
}
if( MENU_DEBRIEF_unlocks_mechs != "" ){
strunzone(MENU_DEBRIEF_unlocks_mechs);
}
if( MENU_DEBRIEF_unlocks_equip != "" ){
strunzone(MENU_DEBRIEF_unlocks_equip);
}
if( SV_NEXTMAP != "" ){
strunzone(SV_NEXTMAP);
}
//server string cleanup
freeGlobalString(CLIENT_INFO_STRING)

freeGlobalString(UNLOCKED_MECHS_DATA)
freeGlobalString(UNLOCKED_ITEMS_DATA)
freeGlobalString(MENU_DEBRIEF_unlocks_mechs)
freeGlobalString(MENU_DEBRIEF_unlocks_equip)
freeGlobalString(SV_NEXTMAP)
freeGlobalString(ENT_SERVER_INFO.svAbout)
freeGlobalString(ENT_SERVER_INFO.nextMap)

freeGlobalString(PLAYER_COLOR_PSC)
freeGlobalString(PLAYER_COLOR_SRV)
freeGlobalString(PLAYER_COLOR_MIL)

freeGlobalString(MAP_NAME);

//config file cleanup
freeGlobalString(DATA_CONFIG_BUFFER_NAME)

freeGlobalString(UNLOCKED_MECHS_DATA)
freeGlobalString(UNLOCKED_ITEMS_DATA)
freeGlobalString(SAVEFILE_CAMPAIGN)
freeGlobalString(SAVEFILE_CACHE_MAP)

freeGlobalString(MENU_DEBRIEF_unlocks_mechs)
freeGlobalString(MENU_DEBRIEF_unlocks_equip)

freeGlobalString(DATA_CONFIG_BUFFER_NAME)

//mission file cleanup
msn_free_strings();

//Entities
freeGlobalString(CLIENT_netname)
freeGlobalString(MISSION_NAME)
freeGlobalString(HUD_INFO_MSG)

localcmd("cd stop\n");
};
Expand All @@ -210,31 +233,41 @@ float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent = {
// the most important function in CSQC...
void(float w, float h, float menuView) CSQC_UpdateView =
{
local vector fovvec, vf_sz, vf_mn;
local entity e;
local vector porg, pang, torg;

local float clientItr;
local float frameItr;
local entity oldSelf;
local entity eClient;

scoreboard_think();

if(ISMENU_PREV != menuView){
//check for player bringing up menu delta
if( ISMENU_PREV == TRUE && menuView == FALSE ){
if( CLIENT_faction == FACTION_SURVEST){
if( PLAYER_COLOR_SRV != cvar_string("cl_color_srv") ){
//player changed Survest color
PLAYER_COLOR_SRV = strzone(cvar_string("cl_color_srv"));
cacheGlobalString(PLAYER_COLOR_SRV, cvar_string("cl_color_srv") )
cl_setmech( CLIENT_MENU_sel_mech );
}
}
else if( CLIENT_faction == FACTION_MILITAR){
if( PLAYER_COLOR_MIL != cvar_string("cl_color_mil") ){
//player changed militar color
PLAYER_COLOR_MIL = strzone(cvar_string("cl_color_mil"));
cacheGlobalString(PLAYER_COLOR_MIL, cvar_string("cl_color_mil") )
cl_setmech( CLIENT_MENU_sel_mech );
}
}
else{
if( PLAYER_COLOR_PSC != cvar_string("cl_color_psc") ){
//player changed PSC color
PLAYER_COLOR_PSC = strzone(cvar_string("cl_color_psc"));
cacheGlobalString(PLAYER_COLOR_PSC, cvar_string("cl_color_psc") )
cl_setmech( CLIENT_MENU_sel_mech );
}
}

}
ISMENU_PREV = menuView;
}
Expand All @@ -244,6 +277,29 @@ void(float w, float h, float menuView) CSQC_UpdateView =
cvar_set("r_shadow_realtime_world", "1");
}

//run prediction...?
eClient = findfloat(world, entnum, clientItr);
while( eClient != world ){
for (frameItr = eClient.sequence + 1; frameItr <= servercommandframe; frameItr = frameItr + 1) {
if (!getinputstate(frameItr)){
break; //erk?... too old?
}
input_sequence = frameItr;
oldSelf = self;
self = eClient;
runstandardplayerphysics(self);
self.clientData.origin = self.origin;
self = oldSelf;
}
clientItr = clientItr + 1;
if( clientItr < 17){
eClient = findfloat(eClient, entnum, clientItr);
}
else{
eClient = world;
}
}

/*
local vector vf_size;
local vector vf_min;
Expand All @@ -264,9 +320,6 @@ void(float w, float h, float menuView) CSQC_UpdateView =
// clear the scene information (entities, polygons, etc)
clearscene();
//=====================================================
local vector fovvec,
vf_sz,
vf_mn;
fovvec = getpropertyvec(VF_FOV); // note this is a vector (x and y are independent)
vf_sz = getpropertyvec(VF_SIZE);
vf_mn = getpropertyvec(VF_MIN);
Expand All @@ -291,7 +344,6 @@ void(float w, float h, float menuView) CSQC_UpdateView =
else{
//note: demonstrates the basics for player-observer mode where you follow another player
if( VIEW_OBS_ID == 2 ){
local entity e;
e = entitybyindex(stof(getplayerkeyvalue(VIEW_OBS_ID+1, "viewentity")));
setproperty(VF_ORIGIN, e.origin);
setproperty(VF_ANGLES, e.angles);
Expand Down Expand Up @@ -339,7 +391,6 @@ void(float w, float h, float menuView) CSQC_UpdateView =
// add clientside entities (MASK_NORMAL)
// add engine networked entities (MASK_ENGINE)
// and engine viewmodel and engine networked entities with the viewdemol flag (MASK_ENGINEVIEWMODELS)
local entity oldSelf;
oldSelf = self;
self = world;
while( (self = nextent(self)) ){
Expand Down Expand Up @@ -417,9 +468,9 @@ void(float w, float h, float menuView) CSQC_UpdateView =
}

if( cvar("developer") ){
local vector porg, pang, torg;
pang = '0 0 0'; //sh, compiler.
torg = '0 0 0';
porg = '0 0 0';
porg_x = pang_x = torg_x = VIEW_ORG_x;
porg_y = pang_y = torg_y = VIEW_MAX_y;
drawstring(porg + gui_percentToPixelRawVec('1 -30'), strcat("Player Origin: ", vtos(getpropertyvec(VF_ORIGIN))), '8 8 0', '0.85 0.85 0.85', 1, 0);
Expand All @@ -445,14 +496,14 @@ float() CSQC_Parse_TempEntity =
id = ReadByte();

switch( id ){
case TE_PLAYER_CRIT:
client_handle_crit( ReadByte(), ReadLong() );
return TRUE;

case TE_CLIENT_INFO:
client_campaign_end_data();
return TRUE;

case TE_SERVERINFO:
client_get_serverinfo();
return TRUE;

case TE_CLIENT_INFO_DM:
client_dm_end_data();
return TRUE;
Expand All @@ -461,14 +512,18 @@ float() CSQC_Parse_TempEntity =
client_get_hud_highlight();
return TRUE;

case TE_FOG_SET:
cl_get_new_fog();
return TRUE;

case TE_ISMENU:
cl_set_menu();
return TRUE;

case TE_MSN_BOUND:
client_event_boundary();
return TRUE;

case TE_AI_VOICE:
snd_hud_trnsmsn_addtoqueue(ReadByte(), ReadByte(), ReadByte(), ReadLong());
return TRUE;

case TE_MISSION_END:
client_event_debrief_active( ReadByte(), ReadShort(), ReadShort(), ReadShort(), ReadShort() );
return TRUE;
Expand Down Expand Up @@ -514,12 +569,12 @@ void(string s) CSQC_Parse_StuffCmd =
local string tempAbout;
local float lenAdjust;

if( cvar("developer") ){
dprint(sprintf("CSQC_Parse_StuffCmd().s = %s\n", s)); //debug
}
argc = tokenize(s);
if(argv(0) == "m"){
if(argv(1) == "msn"){
if( cvar("developer") ){
dprint(sprintf("CSQC_Parse_StuffCmd().s = %s\n", s)); //debug
}
cl_get_msnfile( argv(2) );
return;
}
Expand All @@ -528,27 +583,7 @@ void(string s) CSQC_Parse_StuffCmd =
return;
}
}
else{
if( argv(0) == "svabout" ){
lenAdjust = strlen(s) - 8;
tempAbout = substring(s, 8, lenAdjust );
SV_ABOUT = strzone(tempAbout);
return;
}
if( argv(0) == "fog" ){
cl_get_new_fog( s );
return;
}
if( argv(0) == "cd" ){
cl_get_new_music( s ) ;
return;
}
if( argv(0) == "ismenu"){
cvar_set("cl_ismenu", "1");
setcursormode(0);
localcmd("togglemenu\n");
return;
}
else{
localcmd(s);
}
};
Expand Down Expand Up @@ -682,9 +717,7 @@ void() CSQC_Ent_Remove ={
remove(self.effect3 );
}
}
if(self.netname != "" ){
strunzone(self.netname);
}
freeGlobalString(self.netname)
}
if( wasfreed(self) ){
return;
Expand Down
7 changes: 2 additions & 5 deletions client/data/data_api.qc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ void() data_mech_config_clearBuffer={
local float itr;
itr = 1;
DATA_CONFIG_BUFFER_FILENUM = 0;
if( DATA_CONFIG_BUFFER_NAME != "" ){
strunzone( DATA_CONFIG_BUFFER_NAME );
}
DATA_CONFIG_BUFFER_NAME = "";
freeGlobalString(DATA_CONFIG_BUFFER_NAME)

while( itr < 10 ){
DATA_CONFIG_BUFFER_WEPS[itr] = 0;
Expand Down Expand Up @@ -99,7 +96,7 @@ float( float mechId, float configNum ) data_mech_config_load={
DATA_CONFIG_BUFFER_FILENUM = stof(value);
}
if( token == "name"){
DATA_CONFIG_BUFFER_NAME = strzone(value);
cacheGlobalString(DATA_CONFIG_BUFFER_NAME, value)
}
if( strstrofs(token, "hpt",0) != -1 ){
tokenizebyseparator(token, "_");
Expand Down
50 changes: 50 additions & 0 deletions client/data/data_buildings.qc
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,54 @@ void() data_building_death_end={
};


void() building_floor_th={
local vector checkOrg;

makevectors(self.owner.angles);
checkOrg = self.owner.origin + (v_up * self.owner.mins_z);

if( self.origin != checkOrg ){
self.origin = checkOrg;
}

self.think = building_floor_th;
self.nextthink = time + 1;
};

/*
Taken from server, this should be clientside too.
*/
void() data_building_generate_foundation={
local vector v;
local entity foundation;
local entity notSelf;

foundation = spawn();
foundation.owner = self;

makevectors(self.angles);
v = self.origin + (v_up * self.mins_z);

notSelf = self;
self = foundation;
self.classname = "map_terrain";
switch( notSelf.vec_size ){
case 1:
self.model = "q3mdl/map/plats/plat_small.obj";
break;
case 2:
self.model = "q3mdl/map/plats/plat_medium.obj";
break;
case 3:
self.model = "q3mdl/map/plats/plat_large.obj";
break;
}
self.solid = SOLID_NOT; //just for placement
self.movetype = MOVETYPE_NONE;
setmodel( self, self.model );
setsize(self, self.mins, self.maxs);
setorigin(self, v);
self.solid = SOLID_BSP; //lock it in.
self.drawmask = MASK_NORMAL;
self = notSelf;
};
Loading

0 comments on commit 3e412e7

Please sign in to comment.