Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BallerBude's code base #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion code/botlib/be_ai_goal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,8 +1478,11 @@ int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelfla
//if the bot is in solid or if the area the bot is in has no reachability links
if (!areanum || !AAS_AreaReachability(areanum))
{
#ifdef DEBUG
botimport.Print(PRT_MESSAGE, "bot is in solid or area has no reachability links: %d %d\n",areanum,gs->lastreachabilityarea);
#endif //DEBUG
//use the last valid area the bot was in
areanum = gs->lastreachabilityarea;
if (gs->lastreachabilityarea>0) {areanum = gs->lastreachabilityarea;}
} //end if
//remember the last area with reachabilities the bot was in
gs->lastreachabilityarea = areanum;
Expand Down Expand Up @@ -1567,7 +1570,12 @@ int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelfla
bestweight = weight;
bestitem = li;
} //end if
}
#ifdef DEBUG
else {
botimport.Print(PRT_MESSAGE, "can't reach %d\n", li->entitynum);
} //end if
#endif //DEBUG
} //end if
} //end if
} //end for
Expand Down
10 changes: 5 additions & 5 deletions code/botlib/be_ai_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,10 @@ int BotAvoidSpots(vec3_t origin, aas_reachability_t *reach, bot_avoidspot_t *avo

switch(reach->traveltype & TRAVELTYPE_MASK)
{
case TRAVEL_LADDER: checkbetween = qtrue; break;// patch bots: put priority on ladder travel
case TRAVEL_WALK: checkbetween = qtrue; break;
case TRAVEL_CROUCH: checkbetween = qtrue; break;
case TRAVEL_BARRIERJUMP: checkbetween = qtrue; break;
case TRAVEL_LADDER: checkbetween = qtrue; break;
case TRAVEL_WALKOFFLEDGE: checkbetween = qfalse; break;
case TRAVEL_JUMP: checkbetween = qfalse; break;
case TRAVEL_SWIM: checkbetween = qtrue; break;
Expand Down Expand Up @@ -1302,7 +1302,7 @@ void BotCheckBlocked(bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_mover

// Joe Kari: applying the patch of The Doctor: http://forum.smokin-guns.org/viewtopic.php?f=28&t=3075
//if (!trace.startsolid && (trace.ent != ENTITYNUM_WORLD && trace.ent != ENTITYNUM_NONE) )
if ( trace.ent != ENTITYNUM_WORLD && trace.ent != ENTITYNUM_NONE )
if ( trace.ent != ENTITYNUM_WORLD && trace.ent != ENTITYNUM_NONE )// patch bots: fixes some problems of bots running into things (removed !trace.startsolid && )
{
result->blocked = qtrue;
result->blockentity = trace.ent;
Expand Down Expand Up @@ -2935,10 +2935,10 @@ int BotReachabilityTime(aas_reachability_t *reach)
{
switch(reach->traveltype & TRAVELTYPE_MASK)
{
case TRAVEL_LADDER: return 6;// patch bots: put priority on ladder travel
case TRAVEL_WALK: return 5;
case TRAVEL_CROUCH: return 5;
case TRAVEL_BARRIERJUMP: return 5;
case TRAVEL_LADDER: return 6;
case TRAVEL_WALKOFFLEDGE: return 5;
case TRAVEL_JUMP: return 5;
case TRAVEL_SWIM: return 5;
Expand Down Expand Up @@ -3327,10 +3327,10 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in
#endif //DEBUG
switch(reach.traveltype & TRAVELTYPE_MASK)
{
case TRAVEL_LADDER: *result = BotTravel_Ladder(ms, &reach); break;// patch bots: put priority on ladder travel
case TRAVEL_WALK: *result = BotTravel_Walk(ms, &reach); break;
case TRAVEL_CROUCH: *result = BotTravel_Crouch(ms, &reach); break;
case TRAVEL_BARRIERJUMP: *result = BotTravel_BarrierJump(ms, &reach); break;
case TRAVEL_LADDER: *result = BotTravel_Ladder(ms, &reach); break;
case TRAVEL_WALKOFFLEDGE: *result = BotTravel_WalkOffLedge(ms, &reach); break;
case TRAVEL_JUMP: *result = BotTravel_Jump(ms, &reach); break;
case TRAVEL_SWIM: *result = BotTravel_Swim(ms, &reach); break;
Expand Down Expand Up @@ -3436,10 +3436,10 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in
//
switch(reach.traveltype & TRAVELTYPE_MASK)
{
case TRAVEL_LADDER: *result = BotTravel_Ladder(ms, &reach); break;// patch bots: put priority on ladder travel
case TRAVEL_WALK: *result = BotTravel_Walk(ms, &reach); break;//BotFinishTravel_Walk(ms, &reach); break;
case TRAVEL_CROUCH: /*do nothing*/ break;
case TRAVEL_BARRIERJUMP: *result = BotFinishTravel_BarrierJump(ms, &reach); break;
case TRAVEL_LADDER: *result = BotTravel_Ladder(ms, &reach); break;
case TRAVEL_WALKOFFLEDGE: *result = BotFinishTravel_WalkOffLedge(ms, &reach); break;
case TRAVEL_JUMP: *result = BotFinishTravel_Jump(ms, &reach); break;
case TRAVEL_SWIM: *result = BotTravel_Swim(ms, &reach); break;
Expand Down
77 changes: 57 additions & 20 deletions code/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,38 @@ static float CG_DrawAttacker( float y ) {
}
#endif

/*
================
CG_DrawSpeedMeter

================
*/
static float CG_DrawSpeedMeter( float y ) {
char *s;
int w;
vec_t *vel;
int speed;

/* speed meter can get in the way of the scoreboard */
if ( cg.scoreBoardShowing ) {
return y;
}

vel = cg.snap->ps.velocity;
/* ignore vertical component of velocity */
speed = sqrt(vel[0] * vel[0] + vel[1] * vel[1]);

s = va( "%iu/s", speed );

//w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
w = CG_DrawStrlen( s ) * 11;

//CG_DrawBigString( 635 - w, y + 2, s, 1.0F);
CG_Text_Paint(640-w, y + 5 + BIGCHAR_HEIGHT, 0.4f, colorWhite, s, 0, 0, 3);
return y + BIGCHAR_HEIGHT + 4;
}


/*
==================
CG_DrawSnapshot
Expand Down Expand Up @@ -1508,6 +1540,9 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame)
if ( cg_drawTimer.integer ) {
y = CG_DrawTimer( y );
}
if ( cg_drawspeed.integer ) {
y = CG_DrawSpeedMeter( y );
}
#ifdef SMOKINGUNS
if ( cg_drawdebug.integer ) {
// Draw debug info on the upper right
Expand Down Expand Up @@ -2521,23 +2556,23 @@ void CG_CenterPrint( const char *str, int y, int charWidth ) {
// remove "^" if nessecary
for(i = 0; cg.centerPrint[i]; i++){

// ignore if there are two of them
if(cg.centerPrint[i] == '^'){
remove = qtrue;
continue;
}

if(remove){
int j;

// move the others two steps further
for( j = i-1; cg.centerPrint[j+2]; j++){
cg.centerPrint[j] = cg.centerPrint[j+2];
}
cg.centerPrint[j] = '\0';
remove = qfalse;
i -= 2; // string had been moved back (2 shifts)
}
// // ignore if there are two of them// patch colored names: allow colors
// if(cg.centerPrint[i] == '^'){
// remove = qtrue;
// continue;
// }
//
// if(remove){
// int j;
//
// // move the others two steps further
// for( j = i-1; cg.centerPrint[j+2]; j++){
// cg.centerPrint[j] = cg.centerPrint[j+2];
// }
// cg.centerPrint[j] = '\0';
// remove = qfalse;
// i -= 2; // string had been moved back (2 shifts)
// }
}
#endif

Expand Down Expand Up @@ -4078,8 +4113,7 @@ static void CG_DrawBuyMenu( void ) {

item = CG_GetBuyItem();

if(cg.snap->ps.stats[STAT_MONEY] < item->prize)
return;
if(cg.snap->ps.stats[STAT_MONEY] >= item->prize) {
// don't buy other special weapons if handling a gatling
if(item->giType == IT_WEAPON && bg_weaponlist[item->giTag].wp_sort == WPS_GUN &&
gatling){
Expand Down Expand Up @@ -4116,7 +4150,10 @@ static void CG_DrawBuyMenu( void ) {
cg.weaponSelect = item->giTag;
}
}

} else {
trap_S_StartSound(NULL, cg.snap->ps.clientNum, CHAN_ANNOUNCER, cgs.media.bang[1]);// patch buy: if wecannot buy, don't get stuck in the menu
cg.oldbutton = qtrue;
}
if(numpressed){
CG_CloseBuyMenu();
}
Expand Down
26 changes: 22 additions & 4 deletions code/cgame/cg_drawtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color

if ( style & UI_DROPSHADOW ) {
drawcolor[0] = drawcolor[1] = drawcolor[2] = 0;
drawcolor[3] = color[3];
drawcolor[3] = 0.5;// patch colored loading screen: implement colored dropshadows
UI_DrawBannerString2( x+2, y+2, str, drawcolor );
}

Expand All @@ -808,7 +808,10 @@ int UI_ProportionalStringWidth( const char* str ) {
while ( *s ) {
ch = *s & 127;
charWidth = propMap[ch][2];
if ( charWidth != -1 ) {
if ( Q_IsColorString( s ) ) {// patch colored loading screen: implement colored dropshadows
s += 2;
continue;
} else if ( charWidth != -1 ) {
width += charWidth;
width += PROP_GAP_WIDTH;
}
Expand All @@ -835,6 +838,7 @@ void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, fl
float fcol;
float fwidth;
float fheight;
vec4_t newColor;

// draw the colored text
trap_R_SetColor( color );
Expand All @@ -846,7 +850,21 @@ void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, fl
while ( *s )
{
ch = *s & 127;
if ( ch == ' ' ) {
if ( Q_IsColorString( s ) ) {// patch colored loading screen: implement colored dropshadows
memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) );
newColor[3] = color[3];
if (color[0]!=1 && color[1]!=1 && color[2]!=1 && color[3]==0.5) {
newColor[0]*=0.25;
newColor[1]*=0.25;
newColor[2]*=0.25;
newColor[3]=0.85;
} else {
newColor[3]=1;
}
trap_R_SetColor( newColor );
s += 2;
continue;
} else if ( ch == ' ' ) {
aw = (float)PROP_SPACE_WIDTH * cgs.screenXScale * sizeScale;
} else if ( propMap[ch][2] != -1 ) {
fcol = (float)propMap[ch][0] / 256.0f;
Expand Down Expand Up @@ -916,7 +934,7 @@ void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t

if ( style & UI_DROPSHADOW ) {
drawcolor[0] = drawcolor[1] = drawcolor[2] = 0;
drawcolor[3] = color[3];
drawcolor[3] = 0.5;// patch colored loading screen: implement colored dropshadows
UI_DrawProportionalString2( x+2, y+2, str, drawcolor, sizeScale, cgs.media.charsetProp );
}

Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ static void CG_Obituary( entityState_t *ent ) {
if(weapon){
if ( ent->eFlags & EF_SAME_TEAM )
CG_Printf("%s ^1teamkilled^7 %s with %s.\n", attackerName, targetName, bg_weaponlist[weapon].name );
else
else if ( cg_killmsg.integer == 1 )// patch messages: optionally disable kill messages in chat window. They're still shown in the top right corner.
CG_Printf("%s killed %s with %s.\n", attackerName, targetName, bg_weaponlist[weapon].name );
return;
}
Expand Down
15 changes: 9 additions & 6 deletions code/cgame/cg_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,14 @@ void CG_LoadingClient( int clientNum ) {
}

Q_strncpyz( personality, Info_ValueForKey( info, "n" ), sizeof(personality) );
CG_LoadingString( personality );// patch colored loading screen: draw names before cleaning name
Q_CleanStr( personality );

if( cgs.gametype == GT_SINGLE_PLAYER ) {
trap_S_RegisterSound( va( "sound/player/announce/%s.wav", personality ), qtrue );
}

CG_LoadingString( personality );

}


Expand Down Expand Up @@ -324,18 +325,18 @@ void CG_DrawInformation( void ) {
#ifndef SMOKINGUNS
y = 180-32;
#else
y = 30;
y = 18;// patch colored loading screen
#endif

// don't print server lines if playing a local game
trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) );
if ( !atoi( buf ) ) {
// server hostname
Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024);
Q_CleanStr(buf);
//Q_CleanStr(buf);
UI_DrawProportionalString( 320, y, buf,
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
y += PROP_HEIGHT;
UI_CENTER|UI_DROPSHADOW, colorWhite );
y += PROP_HEIGHT+10;

// pure server
s = Info_ValueForKey( sysInfo, "sv_pure" );
Expand Down Expand Up @@ -375,7 +376,8 @@ void CG_DrawInformation( void ) {
// cheats warning
s = Info_ValueForKey( sysInfo, "sv_cheats" );
if ( s[0] == '1' ) {
UI_DrawProportionalString( 320, y, "CHEATS ARE ENABLED",
y += PROP_HEIGHT;
UI_DrawProportionalString( 320, y, "^1CHEATS ARE ENABLED!",// patch colored loading screen
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
y += PROP_HEIGHT;
#ifndef SMOKINGUNS
Expand Down Expand Up @@ -437,6 +439,7 @@ void CG_DrawInformation( void ) {
s = "Unknown Gametype";
break;
}
y += PROP_HEIGHT;
UI_DrawProportionalString( 320, y, s,
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
y += PROP_HEIGHT;
Expand Down
3 changes: 3 additions & 0 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ extern vmCvar_t cg_serverduellimit;
extern vmCvar_t cg_impactparticles;
extern vmCvar_t cg_gunsmoke;
extern vmCvar_t cg_addguns;
extern vmCvar_t cg_killmsg;
extern vmCvar_t cg_hitmsg;
extern vmCvar_t cg_hitfarmsg;
extern vmCvar_t cg_ownhitmsg;
Expand All @@ -1821,6 +1822,8 @@ extern vmCvar_t cg_debug;
extern vmCvar_t cg_glowflares;
extern vmCvar_t cg_boostfps;
extern vmCvar_t cg_drawdebug;
extern vmCvar_t cg_drawspeed;


//extern vmCvar_t cg_teamredcount;
//extern vmCvar_t cg_teambluecount;
Expand Down
Loading