From d78954f06850c8dd2efd9104b7078e72a8657c68 Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Sat, 9 Oct 2010 19:55:13 +0000 Subject: [PATCH] pf without nades (replaced by pistol clips) and lss with 2 nades git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5729 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 9 ++++----- source/src/entity.h | 6 +++--- source/src/server.cpp | 14 ++------------ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 4cc3a434..9164283a 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -11,8 +11,8 @@ const char *entmdlnames[] = void renderent(entity &e) { - /* FIXME: if the item list change, this "e.twice?5:0" will be messed, but it is useless to provide a general fix for now */ - const char *mdlname = entmdlnames[e.type-I_CLIPS+(e.twice&&e.type==I_GRENADE?5:0)]; + /* FIXME: if the item list change, this hack will be messed */ + const char *mdlname = entmdlnames[e.type-I_CLIPS+(m_lss && e.type==I_GRENADE ? 5:0)]; float z = (float)(1+sinf(lastmillis/100.0f+e.x+e.y)/20), yaw = lastmillis/10.0f; rendermodel(mdlname, ANIM_MAPMODEL|ANIM_LOOP|ANIM_DYNALLOC, 0, 0, vec(e.x, e.y, z+S(e.x, e.y)->floor+e.attr1), yaw, 0); @@ -285,6 +285,7 @@ void pickupeffects(int n, playerent *d) e.spawned = false; if(!d) return; d->pickup(e.type); + if (m_lss && e.type == I_GRENADE) d->pickup(e.type); // get 2 itemstat &is = d->itemstats(e.type); if(d!=player1 && d->type!=ENT_BOT) return; if(&is) @@ -417,14 +418,13 @@ void spawnallitems() // spawns items locally loopv(ents) if(ents[i].fitsmode(gamemode) || (multiplayer(false) && gamespeed!=100 && (i=-1))) { ents[i].spawned = true; - ents[i].twice = false; ents[i].lastmillis = lastmillis; } } void resetspawns(int type) { - loopv(ents) if(type < 0 || type == ents[i].type) ents[i].twice = ents[i].spawned = false; + loopv(ents) if(type < 0 || type == ents[i].type) ents[i].spawned = false; if(m_noitemsnade || m_pistol) { loopv(ents) ents[i].transformtype(gamemode); @@ -435,7 +435,6 @@ void setspawn(int i, bool on) { if(ents.inrange(i)) { - ents[i].twice = (ents[i].type == I_GRENADE && ents[i].spawned && on ? true : false); ents[i].spawned = on; if (on) ents[i].lastmillis = lastmillis; // to control trypickup spam } diff --git a/source/src/entity.h b/source/src/entity.h index d3f4a7f9..e99d1f29 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -31,15 +31,15 @@ struct persistent_entity // map entity struct entity : persistent_entity { - bool spawned, twice; //the dynamic states of a map entity + bool spawned; //the dynamic states of a map entity int lastmillis; - entity(short x, short y, short z, uchar type, short attr1, uchar attr2, uchar attr3, uchar attr4) : persistent_entity(x, y, z, type, attr1, attr2, attr3, attr4), spawned(false), twice(false) {} + entity(short x, short y, short z, uchar type, short attr1, uchar attr2, uchar attr3, uchar attr4) : persistent_entity(x, y, z, type, attr1, attr2, attr3, attr4), spawned(false) {} entity() {} bool fitsmode(int gamemode) { return !m_noitems && isitem(type) && !(m_noitemsnade && type!=I_GRENADE) && !(m_pistol && type==I_AMMO); } void transformtype(int gamemode) { if(m_noitemsnade && type==I_CLIPS) type = I_GRENADE; - else if(m_pistol && type==I_AMMO) type = I_CLIPS; + else if(m_pistol && ( type==I_AMMO || type==I_GRENADE )) type = I_CLIPS; } }; diff --git a/source/src/server.cpp b/source/src/server.cpp index a5ffe6fa..127bda1e 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1265,13 +1265,9 @@ bool serverpickup(int i, int sender) // server side item pickup, acknowl } sendf(-1, 1, "ri3", SV_ITEMACC, i, sender); cl->state.pickup(sents[i].type); - if (e.twice) - { - sendf(-1, 1, "ri3", SV_ITEMACC, i, sender); // FIXME - cl->state.pickup(sents[i].type); - } + if (m_lss && sents[i].type == I_GRENADE) cl->state.pickup(sents[i].type); // get two nades at lss } - e.spawned = e.twice = false; + e.spawned = false; if(!m_lms) e.spawntime = spawntime(e.type); return true; } @@ -1287,11 +1283,6 @@ void checkitemspawns(int diff) sents[i].spawntime = 0; sents[i].spawned = true; sendf(-1, 1, "ri2", SV_ITEMSPAWN, i); - if (m_lss && sents[i].type == I_GRENADE && rnd(101) > 66 ) - { - sents[i].twice = true; - sendf(-1, 1, "ri2", SV_ITEMSPAWN, i); // FIXME - } } } } @@ -1804,7 +1795,6 @@ void startgame(const char *newname, int newmode, int newtime, bool notify) server_entity se = { e.type, false, false, false, 0, smapstats.entposs[i * 3], smapstats.entposs[i * 3 + 1]}; sents.add(se); if(e.fitsmode(smode)) sents[i].spawned = sents[i].legalpickup = true; - sents[i].twice = false; } mapbuffer.setrevision(); logline(ACLOG_INFO, "Map height density information for %s: H = %.2f V = %d, A = %d and MA = %d", smapname, Mheight, Mvolume, Marea, Mopen);