no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@371 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2006-08-28 18:51:43 +00:00
parent b180463d35
commit 41752e52ed
9 changed files with 29 additions and 31 deletions
+4 -2
View File
@@ -315,14 +315,16 @@ void gets2c() // get updates from the server
break;
case ENET_EVENT_TYPE_RECEIVE:
if(disconnecting) conoutf("attempting to disconnect...");
if(disconnecting)
conoutf("attempting to disconnect...");
else localservertoclient(event.packet->data, event.packet->dataLength);
enet_packet_destroy(event.packet);
break;
case ENET_EVENT_TYPE_DISCONNECT:
if(disconnecting) disconnect();
else server_err();
else
server_err();
return;
}
};
+2 -2
View File
@@ -62,12 +62,12 @@ void renderplayer(dynent *d)
int team = rb_team_int(d->team);
sprintf_sd(mdl)("playermodels/%s/0%i", team==TEAM_CLA ? "terrorist" : "counterterrorist", 1 + max(0, min(d->skin, (team==TEAM_CLA ? 3 : 5))));
renderclient(d, isteam(player1->team, d->team), mdl, 1.6f);
renderclient(d, isteam(player1->team, d->team), mdl, 1.55f);
if(d->gunselect>=0 && d->gunselect<NUMGUNS)
{
sprintf_sd(vwep)("weapons/%s/world", hudgunnames[d->gunselect]);
renderclient(d, isteam(player1->team, d->team), vwep, 1.6f);
renderclient(d, isteam(player1->team, d->team), vwep, 1.55f);
};
}
+1
View File
@@ -165,6 +165,7 @@ int main(int argc, char **argv)
!installtex(6, path(newstring("packages/textures/makke/menu.jpg")), xs, ys, false, true) ||
!installtex(4, path(newstring("packages/misc/explosion.jpg")), xs, ys) ||
!installtex(5, path(newstring("packages/misc/items.png")), xs, ys) ||
!installtex(9, path(newstring("packages/misc/teammate.png")), xs, ys) ||
!installtex(10, path(newstring("packages/misc/scope.png")), xs, ys) ||
!installtex(11, path(newstring("packages/misc/flag_icons.png")), xs, ys) ||
!installtex(1, path(newstring("packages/misc/crosshairs/default.png")), xs, ys)) fatal("could not find core textures (hint: run cube from the parent of the bin directory)");
+1 -1
View File
@@ -259,7 +259,7 @@ extern bool akimboside;
extern void checkweaponswitch();
extern void weaponswitch(int gun);
// Added by Rick
extern char *botincrosshair();
extern dynent *botincrosshair();
extern bool intersect(dynent *d, vec &from, vec &to, vec *end = NULL);
// End add by Rick
+9 -13
View File
@@ -360,15 +360,10 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
char *command = getcurcommand();
dynent *player = playerincrosshair();
dynent *bot = botincrosshair();
if(command) draw_textf("> %s_", 20, 1570, 2, (int)command);
else if(closeent[0]) draw_text(closeent, 20, 1570, 2);
else if(player)
{
string plinfo;
if(isteam(player->team, player1->team)) sprintf_s(plinfo)("%s (health:%i armour:%i)", player->name, player->health, player->armour);
else sprintf_s(plinfo)("%s", player->name);
draw_text(plinfo, 20, 1570, 2);
};
else if(player || (bot && (player=bot))) draw_text(player->name, 20, 1570, 2);
renderscores();
if(!rendermenu())
@@ -378,7 +373,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.9f);
glBindTexture(GL_TEXTURE_2D, 10);
glBindTexture(GL_TEXTURE_2D, 10);
glBegin(GL_QUADS);
glColor3ub(255,255,255);
@@ -390,19 +385,20 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glEnd();
glDisable(GL_ALPHA_TEST);
}
else if (player1->gunselect != GUN_SNIPER && !player1->reloading && !player1->state==CS_DEAD)
else if(player1->gunselect != GUN_SNIPER && !player1->reloading && !player1->state==CS_DEAD)
{
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, 1);
bool teammate_in_xhair = player ? (isteam(player->team, player1->team) && player->state!=CS_DEAD) : false;
glBindTexture(GL_TEXTURE_2D, teammate_in_xhair ? 9 : 1);
glBegin(GL_QUADS);
glColor3ub(255,255,255);
if(crosshairfx)
{
if(player1->gunwait) glColor3ub(128,128,128);
else if(player1->health<=25) glColor3ub(255,0,0);
if(player1->gunwait && !teammate_in_xhair) glColor3ub(128,128,128);
else if(player1->health<=25 || teammate_in_xhair) glColor3ub(255,0,0);
else if(player1->health<=50) glColor3ub(255,128,0);
};
float chsize = (float)crosshairsize * (player1->gunselect==GUN_ASSAULT && player1->shots > 3 ? 1.4f : 1.0f);
float chsize = (float)crosshairsize * (player1->gunselect==GUN_ASSAULT && player1->shots > 3 ? 1.4f : 1.0f) * (teammate_in_xhair ? 2.0f : 1.0f);
glTexCoord2d(0.0, 0.0); glVertex2f(VIRTW/2 - chsize, VIRTH/2 - chsize);
glTexCoord2d(1.0, 0.0); glVertex2f(VIRTW/2 + chsize, VIRTH/2 - chsize);
glTexCoord2d(1.0, 1.0); glVertex2f(VIRTW/2 + chsize, VIRTH/2 + chsize);
+2 -2
View File
@@ -106,8 +106,8 @@ int texx[MAXTEX]; // ( loaded texture ) -> ( name, siz
int texy[MAXTEX];
string texname[MAXTEX];
int curtex = 0;
const int FIRSTTEX = 130; // opengl id = loaded id + FIRSTTEX
// std 1+, sky 14+, md3's 30+,md2's 40+, menu 120+
const int FIRSTTEX = 160; // opengl id = loaded id + FIRSTTEX
// std 1+, sky 14+, md3's 30+,md2's 40+
const int MAXFRAMES = 2; // increase to allow more complex shader defs
int mapping[256][MAXFRAMES]; // ( cube texture, frame ) -> ( opengl id, name )
+2 -4
View File
@@ -293,11 +293,9 @@ COMMAND(updatefrommaster, ARG_NONE);
void writeservercfg()
{
FILE *f = fopen("servers.cfg", "w");
FILE *f = fopen("config/servers.cfg", "w");
if(!f) return;
fprintf(f, "// servers connected to are added here automatically\n\n");
loopvrev(servers) fprintf(f, "addserver %s\n", servers[i].name);
fclose(f);
};
};
+7 -6
View File
@@ -91,7 +91,7 @@ COMMAND(altattack, ARG_NONE);
void reload(dynent *d)
{
if(!d || d->reloading) return;
if(scoped) togglescope();
if(d == player1 && scoped) togglescope();
bool akimbo = d->gunselect==GUN_PISTOL && d->akimbo!=0;
if(d->gunselect==GUN_KNIFE || d->gunselect==GUN_GRENADE) return;
@@ -121,7 +121,8 @@ void reload(dynent *d)
}
if(akimbo) playsoundc(S_RAKIMBO);
else playsoundc(guns[d->gunselect].reload);
else if(d->bIsBot) playsound(guns[d->gunselect].reload, &d->o);
else playsoundc(guns[d->gunselect].reload);
};
void selfreload() { reload(player1); };
@@ -179,7 +180,7 @@ bool intersect(dynent *d, vec &from, vec &to, vec *end) // if lineseg hits ent
dynent *playerincrosshair()
{
if(demoplayback) return NULL;
if(demoplayback) return NULL;
loopv(players)
{
dynent *o = players[i];
@@ -189,14 +190,14 @@ dynent *playerincrosshair()
return NULL;
};
// Added by Rick
char *botincrosshair()
dynent *botincrosshair()
{
if(demoplayback) return NULL;
loopv(bots)
{
dynent *o = bots[i];
if(!o) continue;
if(intersect(o, player1->o, worldpos)) return o->name;
if(intersect(o, player1->o, worldpos)) return o;
};
return NULL;
};
@@ -457,7 +458,7 @@ physent *new_nade(dynent *d, int millis = 0)
d->inhandnade = p;
d->thrownademillis = 0;
playsound(S_GRENADEPULL, &d->o);
playsound(S_GRENADEPULL, (d==player1 ? NULL : &d->o));
return p;
};
+1 -1
View File
@@ -211,7 +211,6 @@ extern void preload_mapmodels();
void load_world(char *mname) // still supports all map formats that have existed since the earliest cube betas!
{
loadingscreen();
preparectf(true);
stopifrecording();
cleardlights();
@@ -219,6 +218,7 @@ void load_world(char *mname) // still supports all map formats that have
setnames(mname);
gzFile f = gzopen(cgzname, "rb9");
if(!f) { conoutf("could not read map %s", (int)cgzname); return; };
loadingscreen();
gzread(f, &hdr, sizeof(header)-sizeof(int)*16);
endianswap(&hdr.version, sizeof(int), 4);
if(strncmp(hdr.head, "CUBE", 4)!=0 && strncmp(hdr.head, "ACMP",4)!=0) fatal("while reading map: header malformatted");