diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 46027f20..dcdc8ee9 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -797,8 +797,8 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) case SV_LMSITEM: { - const char *names[] = { "no items", "pistol clips", "ammoboxes", "grenades", "health packs", "armour", "akimbo" }; - const int types[] = { NOTUSED, I_CLIPS, I_AMMO, I_GRENADE, I_HEALTH, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); + const char *names[] = { "no items", "pistol clips", "ammoboxes", "grenades", "health packs", "helmet", "armour", "akimbo" }; + const int types[] = { NOTUSED, I_CLIPS, I_AMMO, I_GRENADE, I_HEALTH, I_HELMET, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); int cmd = getint(p), typ = getint(p); int n = 0; loopi(types_n) if(typ == types[i]) n = i; diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 495f909c..f246070f 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -6,7 +6,7 @@ vector ents; const char *entmdlnames[] = { - "pickups/pistolclips", "pickups/ammobox", "pickups/nades", "pickups/health", "pickups/kevlar", "pickups/akimbo", + "pickups/pistolclips", "pickups/ammobox", "pickups/nades", "pickups/health", "pickups/helmet", "pickups/kevlar", "pickups/akimbo", }; void renderent(entity &e) diff --git a/source/src/entity.h b/source/src/entity.h index edc8d991..a1126f6a 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -3,8 +3,9 @@ enum // static entity types NOTUSED = 0, // entity slot not in use in map LIGHT, // lightsource, attr1 = radius, attr2 = intensity PLAYERSTART, // attr1 = angle, attr2 = team - I_CLIPS, I_AMMO, I_GRENADE, - I_HEALTH, I_ARMOUR, I_AKIMBO, + I_CLIPS, I_AMMO, I_GRENADE, + I_HEALTH, I_HELMET, I_ARMOUR, I_AKIMBO, + // helmet : 2010may16 -> mapversion:8 MAPMODEL, // attr1 = angle, attr2 = idx CARROT, // attr1 = tag, attr2 = type LADDER, @@ -235,8 +236,10 @@ public: case I_AMMO: return ammostats[primary]; case I_GRENADE: return ammostats[GUN_GRENADE]; case I_AKIMBO: return ammostats[GUN_AKIMBO]; - case I_HEALTH: return powerupstats[0]; // FIXME: unify - case I_ARMOUR: return powerupstats[1]; + case I_HEALTH: + case I_HELMET: + case I_ARMOUR: + return powerupstats[type-I_HEALTH]; default: return *(itemstat *)0; } @@ -250,7 +253,9 @@ public: case I_AMMO: return ammo[primary] if(data[i].code == code) return i; } - + return -1; } }; @@ -161,7 +161,7 @@ void createutf8charset() SDL_Surface *charsetsurface = SDL_CreateRGBSurface(SDL_SWSURFACE, isize, isize, 32, RMASK, GMASK, BMASK, AMASK); if(charsetsurface) - { + { SDL_Color color; color.r = 255; color.g = 255; @@ -169,12 +169,12 @@ void createutf8charset() int posx = 0; int posy = 0; - + loopv(utf8chars) { font::utf8charinfo &charinfo = utf8chars[i]; int code = charinfo.code; - + char u[5] = {0,0,0,0,0}; utf8::append(code, u); @@ -192,7 +192,7 @@ void createutf8charset() // blit onto charset SDL_SetAlpha(fontsurface, 0, 0); blitsurface(charsetsurface, fontsurface, posx, posy); - + // update charinfo properties charinfo.x = posx; charinfo.y = posy; @@ -308,15 +308,18 @@ static void text_color(char c, char *stack, int size, int &sp, bvec color, int a else stack[sp] = c; switch(abs(stack[sp])) { - case '0': color = bvec(64, 255, 128); break; // green: player talk - case '1': color = bvec(96, 160, 255); break; // blue: team chat - case '2': color = bvec(255, 192, 64); break; // yellow: gameplay action messages, only actions done by players - case '3': color = bvec(255, 64, 64); break; // red: important errors and notes - case '4': color = bvec(128, 128, 128); break; // gray - case '5': color = bvec(255, 255, 255); break; // white - case '6': color = bvec(96, 48, 0); break; // dark brown - case '7': color = bvec(128, 48, 48); break; // dark red: dead admin + case '0': color = bvec( 64, 255, 128 ); break; // green: player talk + case '1': color = bvec( 96, 160, 255 ); break; // blue: team chat + case '2': color = bvec( 255, 192, 64 ); break; // yellow: gameplay action messages, only actions done by players + case '3': color = bvec( 255, 64, 64 ); break; // red: important errors and notes + case '4': color = bvec( 128, 128, 128 ); break; // gray + case '5': color = bvec( 255, 255, 255 ); break; // white + case '6': color = bvec( 96, 48, 0 ); break; // dark brown + case '7': color = bvec( 128, 48, 48 ); break; // dark red: dead admin + case '8': color = bvec( 192, 64, 192 ); break; // magenta + case '9': color = bvec( 255, 128, 0 ); break; // orange // white (provided color): everything else + //default: color = bvec( 255, 255, 255 ); break; } int b = (int) (sinf(lastmillis / 200.0f) * 115.0f); b = stack[sp] > 0 ? 100 : min(abs(b), 100); @@ -496,52 +499,52 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i } int y = 0, x = 0, col = 0, colx = 0; - + for(std::string::iterator iter = text.begin(); iter != text.end(); utf8::next(iter, text.end())) { int c = utf8::peek_next(iter, text.end()); - if(iter == cursoriter) - { - cx = x; - cy = y; - cc = c; + if(iter == cursoriter) + { + cx = x; + cy = y; + cc = c; } - if(c=='\t') - { - if(columns && collength()) + if(c=='\t') + { + if(columns && collength()) { colx += (*columns)[col++]; x = colx; } else x = TABALIGN(x); } - else if(c==' ') - { - x += curfont->defaultw; + else if(c==' ') + { + x += curfont->defaultw; } - else if(c=='\n') - { - x = 0; - y += FONTH; + else if(c=='\n') + { + x = 0; + y += FONTH; } - else if(c=='\f') - { + else if(c=='\f') + { std::string::iterator test = iter; test++; if(test != end) - { + { c = utf8::next(iter, end); text_color(c, colorstack, sizeof(colorstack), colorpos, color, a); } } - else if(c=='\a') - { + else if(c=='\a') + { std::string::iterator next = iter; next++; if(next != end) - { + { iter++; } @@ -551,7 +554,7 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i font::charinfo &cinfo = getcharinfo(c); if(maxwidth != -1) - { + { std::string::iterator next = iter; int w = cinfo.w; @@ -561,19 +564,19 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i int c = utf8::next(test, end); if(test == end) break; - if(c=='\f') - { + if(c=='\f') + { std::string::iterator test = iter; utf8::advance(test, 2, end); if(test == end) break; utf8::next(iter, end); - continue; + continue; } if(utf8::distance(iter, next) > 16) break; //if(!curfont->chars.inrange(c-curfont->skip)) fixme if(c < curfont->skip) // fixme { - break; + break; } int cw = getcharinfo(c).w + 1; if(w + cw >= maxwidth) break; @@ -584,28 +587,28 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i } while(true); if(x + w >= maxwidth && next != begin) //fixme - { - x = 0; - y += FONTH; + { + x = 0; + y += FONTH; } for(; next <= iter && next != end; ) { int c = utf8::peek_next(next, end); if(next == cursoriter) { cx = x; cy = y; cc = c; } - - if(c=='\f') - { + + if(c=='\f') + { std::string::iterator test = next; utf8::next(test, end); - if(test != end) - { + if(test != end) + { c = utf8::next(next, end); text_color(c, colorstack, sizeof(colorstack), colorpos, color, a); } } - else - { + else + { x += draw_char(c, left+x, top+y)+1; } @@ -614,7 +617,7 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i } else - { + { x += draw_char(c, left+x, top+y)+1; } } diff --git a/source/src/server.cpp b/source/src/server.cpp index 8e8c7bbc..7ba881d8 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1054,7 +1054,7 @@ void arenacheck() void lmscheck() // spawn random item class once per round { - const int types[] = { I_CLIPS, I_AMMO, I_GRENADE, I_GRENADE, I_HEALTH, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); // double probability for grenades ;) + const int types[] = { I_CLIPS, I_AMMO, I_GRENADE, I_GRENADE, I_HEALTH, I_HELMET, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); // double probability for grenades ;) static bool cleared = false, announced = false, spawned = false; #ifndef LMS_CLEARATROUNDSTART static int lasttypes[LMS_ITEMMAXAGE + 1] = { NOTUSED }; @@ -1223,6 +1223,7 @@ int spawntime(int type) case I_AMMO: case I_GRENADE: sec = np*2; break; case I_HEALTH: sec = np*5; break; + case I_HELMET: case I_ARMOUR: sec = 20; break; case I_AKIMBO: sec = 60; break; } @@ -1370,8 +1371,8 @@ void updatesdesc(const char *newdesc, ENetAddress *caller = NULL) int canspawn(client *c) // beware: canspawn() doesn't check m_arena! { - if(!c || c->type == ST_EMPTY || !c->isauthed || !team_isvalid(c->team) || - (servmillis - c->connectmillis < 5000 && gamemillis > 10000 && clientnumber > 3) ) return -1; + if(!c || c->type == ST_EMPTY || !c->isauthed || !team_isvalid(c->team)/* || + (servmillis - c->connectmillis < 5000 && gamemillis > 10000 && clientnumber > 3) */ ) return -1; if(!c->isonrightmap) return SP_WRONGMAP; if(mastermode == MM_MATCH && matchteamsize) { @@ -2125,7 +2126,7 @@ int checktype(int type, client *cl) SV_CLIENT }; // only allow edit messages in coop-edit mode static int edittypes[] = { SV_EDITENT, SV_EDITH, SV_EDITT, SV_EDITS, SV_EDITD, SV_EDITE, SV_NEWMAP }; - if(cl) + if(cl) { loopi(sizeof(servtypes)/sizeof(int)) if(type == servtypes[i]) return -1; loopi(sizeof(edittypes)/sizeof(int)) if(type == edittypes[i]) return smode==GMODE_COOPEDIT ? type : -1; diff --git a/source/src/server.h b/source/src/server.h index 50d0955a..b1cc38ee 100644 --- a/source/src/server.h +++ b/source/src/server.h @@ -364,31 +364,30 @@ const char *messagenames[SV_NUM] = const char *entnames[MAXENTTYPES] = { - "none?", "light", "playerstart", - "pistol", "ammobox","grenades", - "health", "armour", "akimbo", - "mapmodel", "trigger", - "ladder", "ctf-flag", - "sound", "clip", "plclip" + "none?", + "light", "playerstart", "pistol", "ammobox","grenades", + "health", "helmet", "armour", "akimbo", + "mapmodel", "trigger", "ladder", "ctf-flag", "sound", "clip", "plclip" }; itemstat ammostats[NUMGUNS] = { {1, 1, 1, S_ITEMAMMO}, //knife dummy {16, 32, 72, S_ITEMAMMO}, //pistol - {15, 30, 30, S_ITEMAMMO}, //rifle (temporary values) + {15, 30, 30, S_ITEMAMMO}, //rifle (temporary values) {14, 28, 21, S_ITEMAMMO}, //shotgun {60, 90, 90, S_ITEMAMMO}, //subgun {10, 20, 15, S_ITEMAMMO}, //sniper {30, 60, 60, S_ITEMAMMO}, //assault {2, 0, 2, S_ITEMAMMO}, //grenade - {72, 0, 72, S_ITEMAKIMBO} //akimbo + {72, 0, 72, S_ITEMAKIMBO} //akimbo }; itemstat powerupstats[I_ARMOUR-I_HEALTH+1] = { - {33, 100, 100, S_ITEMHEALTH}, //health - {50, 100, 100, S_ITEMARMOUR}, //armour + {33, 0, 100, S_ITEMHEALTH}, // 0 health + {10, 0, 100, S_ITEMARMOUR}, // 1 helmet + {50, 0, 100, S_ITEMARMOUR}, // 2 armour }; guninfo guns[NUMGUNS] = diff --git a/source/src/serverfiles.h b/source/src/serverfiles.h index ef061acf..af877c8e 100644 --- a/source/src/serverfiles.h +++ b/source/src/serverfiles.h @@ -565,7 +565,7 @@ struct servernickblacklist : serverconfigfile } }; -// serverpdw.cfg +// serverpwd.cfg #define ADMINPWD_MAXPAR 1 struct pwddetail diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 7bf303ec..8e7c2b55 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -1103,6 +1103,11 @@ void sniperrifle::setscope(bool enable) { if(scoped == false && enable == true) scoped_since = lastmillis; if(player1 == owner && enable != scoped) addmsg(SV_SCOPE, "ri2", lastmillis, enable); + // 2010 MAY 17 : flowtron: + // if(watching_demo) we might need to ignore some messages + // e.g. I got one where I pressed SCOPE during the auto-reload - + // that makes it pop up during playback, but not during actual gametime + // since then reloading was true - seems it isn't during playback - test, verify, correct bug .. test, verify .. commit scoped = enable; } } diff --git a/source/src/world.h b/source/src/world.h index 8bea0508..f7f01b55 100644 --- a/source/src/world.h +++ b/source/src/world.h @@ -32,7 +32,7 @@ enum // hardcoded texture numbers DEFAULT_CEIL }; -#define MAPVERSION 7 // bump if map format changes, see worldio.cpp +#define MAPVERSION 8 // bump if map format changes, see worldio.cpp struct header // map file format header { @@ -94,7 +94,9 @@ struct mapstats case 8: /* old boost */ \ e.type=I_HEALTH; \ break; \ - case 9: /* armor */ \ + case 9: /* armour */ \ + e.type=I_HELMET; \ + break; \ case 10: /* armor */ \ e.type=I_ARMOUR; \ break; \ @@ -107,7 +109,10 @@ struct mapstats default: \ e.type=NOTUSED; \ } \ - } + } \ + if(headr.version>=6 && headr.version<8) { \ + if( e.type >= I_HELMET && e.type < (MAXENTTYPES - 1) ) { e.type += 1; } \ + } #define SWS(w,x,y,s) (&(w)[((y)<<(s))+(x)]) #define SW(w,x,y) SWS(w,x,y,sfactor) diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 2142c7aa..22f7a653 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -353,8 +353,8 @@ void save_world(char *mname) setnames(mname); backup(cgzname, bakname); // MediaPacks (flowtron) 2009oct07 - // - check map dependencies and - // set the appropriate value (NULL, "-1" or "A,B,C,...") + // - check map dependencies and + // set the appropriate value (NULL, "-1" or "A,B,C,...") // in the header checkmapdependencies(true); copystring(hdr.mediareq, reqmpak, 128); @@ -501,7 +501,7 @@ bool load_world(char *mname) // still supports all map formats that have f->read(&e, sizeof(persistent_entity)); lilswap((short *)&e, 4); e.spawned = false; - TRANSFORMOLDENTITIES(hdr) + TRANSFORMOLDENTITIES(hdr) if(e.type == PLAYERSTART && (e.attr2 == 0 || e.attr2 == 1 || e.attr2 == 100)) { if(e.attr2 == 100) @@ -560,8 +560,6 @@ bool load_world(char *mname) // still supports all map formats that have } case SOLID: { - //TODO 2010apr02 : flowtron - // should do something about knowledege of row/col here, to update bbx,bby(,bbz) s->type = SOLID; s->wtex = f->getchar(); s->vdelta = f->getchar();