]> git.xolatile.top Git - xolatile-badassbug.git/commitdiff
More cleanups...
authorxolatile <xolatile@proton.me>
Wed, 6 Aug 2025 22:32:29 +0000 (00:32 +0200)
committerxolatile <xolatile@proton.me>
Wed, 6 Aug 2025 22:32:29 +0000 (00:32 +0200)
32 files changed:
data/defaults.cfg
data/menus.cfg
data/stdedit.cfg
src/engine/console.cpp
src/engine/engine.h
src/engine/lightmap.cpp
src/engine/main.cpp
src/engine/master.cpp
src/engine/menus.cpp
src/engine/octaedit.cpp
src/engine/physics.cpp
src/engine/rendergl.cpp
src/engine/rendermodel.cpp
src/engine/renderva.cpp
src/engine/server.cpp
src/engine/shader.cpp
src/engine/textedit.h
src/engine/world.cpp
src/engine/worldio.cpp
src/fpsgame/ai.h
src/fpsgame/entities.cpp
src/fpsgame/fps.cpp
src/fpsgame/game.h
src/fpsgame/scoreboard.cpp
src/fpsgame/server.cpp
src/shared/ents.h
src/shared/geom.cpp
src/shared/iengine.h
src/shared/igame.h
src/shared/stream.cpp
src/shared/tools.h
src/shared/zip.cpp

index 71e4687d91966af1e22f5fbd071408200e3395c4..5c3b907b47d3b3896dfccab99877b8ed53b10eb6 100644 (file)
@@ -175,7 +175,6 @@ editbind F9 [echo (getseltex) : (gettexname (getseltex))] // echo texture info
 //      bind HOME [ edittex 1 ]
 //      bind END [ edittex -1 ]
 
-
 editbind G [ domodifier 1 ] // domodifier 1 -> executes delta_edit_1
 editbind F [ domodifier 2 ] // etc...
 editbind Q [ domodifier 3 ]
index ac605013052d60c84591c534d6f91af4927e4f33..a646276ab3a03797d7c4faee1501cbb4102261b0 100644 (file)
@@ -723,7 +723,6 @@ newgui ammobar [
     ]
 ] "AmmoBar"
 
-
 newgui gameclock [
     guicheckbox "GameClock" gameclock
     guibar
@@ -761,7 +760,6 @@ newgui gameclock [
     ]
 ] "GameClock"
 
-
 newgui hudscore [
     guicheckbox "HUDScore" hudscore
     guibar
index 5a319cc85303deef3fca50025326e5895c90d399..6a13f5fad2395d11999858495072f8da3b525a82 100644 (file)
@@ -48,7 +48,6 @@ enttypelist = [
   shells bullets rockets riflerounds grenades cartridges
   health healthboost tinyhealth tinyarmour greenarmour yellowarmour quaddamage
   teleport teledest jumppad
-  spotlight
 ]
 
 enttypeselect = [
@@ -63,7 +62,6 @@ enttypeselect = [
 ent_action_teleport       = [ entproperty 0 ( * $arg1 1 ) ]
 ent_action_teledest       = [ entproperty 1 ( * $arg1 1 ) ]
 ent_action_mapmodel       = [ entproperty 1 ( * $arg1 1 ) ]
-ent_action_spotlight      = [ entproperty 0 ( * $arg1 5 ) ]
 ent_action_light          = [ entproperty 0 ( * $arg1 5 ) ]
 ent_action_jumppad        = [ entproperty 0 ( * $arg1 5 ) ]
 ent_action_playerstart    = [ entproperty 0 ( * $arg1 15 ) ]
index 1386570d213591d806ee654b187b0691ee62f26f..b770bd1e0750fa69b531f216724be3e0fe920297 100644 (file)
@@ -126,7 +126,7 @@ int renderconsole(int w, int h, int abovehud) {                                // render buffer taking in
        int conpad = fullconsole ? 0 : FONTH/4,
                conoff = fullconsole ? FONTH : FONTH/3,
                conheight = min(fullconsole ? ((h*fullconsize/100)/FONTH)*FONTH : FONTH*consize, h - 2*(conpad + conoff)),
-               conwidth = w - 2*(conpad + conoff) - (fullconsole ? 0 : game::clipconsole(w, h));
+               conwidth = w - 2*(conpad + conoff);
        extern void consolebox(int x1, int y1, int x2, int y2);
        if(fullconsole) consolebox(conpad, conpad, conwidth+conpad+2*conoff, conheight+conpad+2*conoff);
        int y = drawconlines(conskip, fullconsole ? 0 : confade, conwidth, conheight, conpad+conoff, fullconsole ? fullconfilter : confilter);
index 7bc0ef1b7f0835ee569adbcc9eacbb950c3eb59e..f50a55858d7d8f790f70533dcd1d230f9cf7f026 100644 (file)
@@ -278,9 +278,6 @@ extern void setupmaterials(int start = 0, int len = 0);
 extern void rendermaterials();
 extern int visiblematerial(const cube &c, int orient, const ivec &co, int size, ushort matmask = 0);
 
-// server
-extern vector<const char *> gameargs;
-
 extern void initserver(bool listen, bool dedicated);
 extern void cleanupserver();
 extern void serverslice(bool dedicated, uint timeout);
@@ -289,7 +286,6 @@ extern void updatetime();
 extern ENetSocket connectmaster(bool wait);
 extern void localclienttoserver(int chan, ENetPacket *);
 extern void localconnect();
-extern bool serveroption(char *opt);
 
 // serverbrowser
 extern bool resolverwait(const char *name, ENetAddress *address);
@@ -385,7 +381,6 @@ extern vector<int> outsideents;
 
 extern void entcancel();
 extern void entitiesinoctanodes();
-extern void attachentities();
 extern void freeoctaentities(cube &c);
 extern bool pointinsel(const selinfo &sel, const vec &o);
 
index 1481de91a770cf8e83a3fe261290f7cb919f8d64..0a9daf107068e3903540159e3db94fdb2448d65a 100644 (file)
@@ -376,12 +376,6 @@ static uint generatelumel(lightmapworker *w, const float tolerance, uint lightma
                ray.mul(1.0f / mag);
                float angle = -ray.dot(normal);
                if(angle <= 0) continue;
-               if(light.attached && light.attached->type==ET_SPOTLIGHT) {
-                       vec spot = vec(light.attached->o).sub(light.o).normalize();
-                       float maxatten = sincos360[clamp(int(light.attached->attr1), 1, 89)].x, spotatten = (ray.dot(spot) - maxatten) / (1 - maxatten);
-                       if(spotatten <= 0) continue;
-                       attenuation *= spotatten;
-               }
                if(lmshadows && mag) {
                        float dist = shadowray(w->shadowraycache, light.o, ray, mag - tolerance, RAY_SHADOW | (lmshadows > 1 ? RAY_ALPHAPOLY : 0));
                        if(dist < mag - tolerance) continue;
@@ -1738,12 +1732,6 @@ void lightreaching(const vec &target, vec &color, vec &dir, bool fast, extentity
                float intensity = 1;
                if(e.attr1)
                        intensity -= mag / float(e.attr1);
-               if(e.attached && e.attached->type==ET_SPOTLIGHT) {
-                       vec spot = vec(e.attached->o).sub(e.o).normalize();
-                       float maxatten = sincos360[clamp(int(e.attached->attr1), 1, 89)].x, spotatten = (ray.dot(spot) - maxatten) / (1 - maxatten);
-                       if(spotatten <= 0) continue;
-                       intensity *= spotatten;
-               }
                vec lightcol = vec(e.attr2, e.attr3, e.attr4).mul(1.0f/255);
                color.add(vec(lightcol).mul(intensity));
                dir.add(vec(ray).mul(-intensity*lightcol.x*lightcol.y*lightcol.z));
@@ -1773,12 +1761,6 @@ entity *brightestlight(const vec &target, const vec &dir) {
                float intensity = 1;
                if(e.attr1)
                        intensity -= mag / float(e.attr1);
-               if(e.attached && e.attached->type==ET_SPOTLIGHT) {
-                       vec spot = vec(e.attached->o).sub(e.o).normalize();
-                       float maxatten = sincos360[clamp(int(e.attached->attr1), 1, 89)].x, spotatten = (ray.dot(spot) - maxatten) / (1 - maxatten);
-                       if(spotatten <= 0) continue;
-                       intensity *= spotatten;
-               }
                if(!brightest || intensity > bintensity) {
                        brightest = &e;
                        bintensity = intensity;
index a059c132607e9f25910e5068686333566f1f3829..5e3b1c8658040e9fb180d6888f2f8c2b92e33e3b 100644 (file)
@@ -21,7 +21,6 @@ void cleanup() {
        extern void clear_console(); clear_console();
        extern void clear_mdls();       clear_mdls();
        extern void clear_sound();   clear_sound();
-       closelogfile();
        SDL_Quit();
 }
 
@@ -899,59 +898,16 @@ int getclockmillis() {
 
 VAR(numcpus, 1, 1, 16);
 
-int main(int argc, char **argv) {
-       setlogfile(NULL);
+int main(void) {
        int dedicated = 0;
        char *load = NULL, *initscript = NULL;
        initing = INIT_RESET;
-       // set home dir first
-       for(int i = 1; i<argc; i++) if(argv[i][0]=='-' && argv[i][1] == 'q') { sethomedir(&argv[i][2]); break; }
-       // set log after home dir, but before anything else
-       for(int i = 1; i<argc; i++) if(argv[i][0]=='-' && argv[i][1] == 'g') {
-               const char *file = argv[i][2] ? &argv[i][2] : "log.txt";
-               setlogfile(file);
-               logoutf("Setting log file: %s", file);
-               break;
-       }
        execfile("init.cfg", false);
-       for(int i = 1; i<argc; i++) {
-               if(argv[i][0]=='-') switch(argv[i][1]) {
-                       case 'q': if(homedir[0]) logoutf("Using home directory: %s", homedir); break;
-                       case 'r': /* compat, ignore */ break;
-                       case 'k': {
-                               const char *dir = addpackagedir(&argv[i][2]);
-                               if(dir) logoutf("Adding package directory: %s", dir);
-                               break;
-                       }
-                       case 'g': break;
-                       case 'd': dedicated = atoi(&argv[i][2]); if(dedicated<=0) dedicated = 2; break;
-                       case 'w': scr_w = clamp(atoi(&argv[i][2]), SCR_MINW, SCR_MAXW); if(!findarg(argc, argv, "-h")) scr_h = -1; break;
-                       case 'h': scr_h = clamp(atoi(&argv[i][2]), SCR_MINH, SCR_MAXH); if(!findarg(argc, argv, "-w")) scr_w = -1; break;
-                       case 'z': depthbits = atoi(&argv[i][2]); break;
-                       case 'b': /* compat, ignore */ break;
-                       case 'a': fsaa = atoi(&argv[i][2]); break;
-                       case 'v': /* compat, ignore */ break;
-                       case 't': fullscreen = atoi(&argv[i][2]); break;
-                       case 's': /* compat, ignore */ break;
-                       case 'f': /* compat, ignore */ break;
-                       case 'l': {
-                               char pkgdir[] = "packages/";
-                               load = strstr(path(&argv[i][2]), path(pkgdir));
-                               if(load) load += sizeof(pkgdir)-1;
-                               else load = &argv[i][2];
-                               break;
-                       }
-                       case 'x': initscript = &argv[i][2]; break;
-                       default: if(!serveroption(argv[i])) gameargs.add(argv[i]); break;
-               }
-               else gameargs.add(argv[i]);
-       }
        initing = NOT_INITING;
        numcpus = clamp(SDL_GetCPUCount(), 1, 16);
        if(dedicated <= 1) {
                logoutf("init: sdl");
                if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_AUDIO)<0) fatal("Unable to initialize SDL: %s", SDL_GetError());
-
 #ifdef SDL_VIDEO_DRIVER_X11
                SDL_version version;
                SDL_GetVersion(&version);
@@ -964,7 +920,6 @@ int main(int argc, char **argv) {
        atexit(enet_deinitialize);
        enet_time_set(0);
        logoutf("init: game");
-       game::parseoptions(gameargs);
        initserver(dedicated>0, dedicated>1);  // never returns if dedicated
        ASSERT(dedicated <= 1);
        game::initclient();
index c1d3e20bcc2688dbb94d2dd9fa61d935bc43a964..92d1b97e92a7101a67b1bb55330fd93f9a8cb376 100644 (file)
@@ -20,8 +20,6 @@
 #define SERVER_LIMIT 4096
 #define SERVER_DUP_LIMIT 10
 
-FILE *logfile = NULL;
-
 struct userinfo {
        char *name;
        void *pubkey;
@@ -126,15 +124,15 @@ enet_uint32 servtime = 0;
 void fatal(const char *fmt, ...) {
        va_list args;
        va_start(args, fmt);
-       vfprintf(logfile, fmt, args);
-       fputc('\n', logfile);
+       vfprintf(stdout, fmt, args);
+       fputc('\n', stdout);
        va_end(args);
        exit(EXIT_FAILURE);
 }
 
 void conoutfv(int type, const char *fmt, va_list args) {
-       vfprintf(logfile, fmt, args);
-       fputc('\n', logfile);
+       vfprintf(stdout, fmt, args);
+       fputc('\n', stdout);
 }
 
 void purgeclient(int n) {
@@ -570,9 +568,7 @@ int main(int argc, char **argv) {
        defformatstring(cfgname, "%smaster.cfg", dir);
        path(logname);
        path(cfgname);
-       logfile = fopen(logname, "a");
-       if(!logfile) logfile = stdout;
-       setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
+       setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
        signal(SIGUSR1, reloadsignal);
        setupserver(port, ip);
        for(;;) {
index e2bd26683297239442b3261c29e5bbb1efe0e2f6..e91c6a2ae4c43ccc2dfc23786edefc0427b1b7bd 100644 (file)
@@ -411,7 +411,6 @@ void guikeyfield(char *var, int *maxlength, char *onchange) {
 
 //use text<action> to do more...
 
-
 void guilist(uint *contents) {
        if(!cgui) return;
        cgui->pushlist();
index 0da305d5b621d5ec9dd0c9a1954ae74baad06fec..7947e67a6351a7ba5c0ec52a911aa22a275bbbb2 100644 (file)
@@ -1706,7 +1706,6 @@ int shouldpacktex(int index) {
        return 0;
 }
 
-
 bool mpedittex(int tex, int allfaces, selinfo &sel, ucharbuf &buf) {
        if(!unpacktex(tex, buf)) return false;
        mpedittex(tex, allfaces, sel, false);
index a43e8b4d4d006f5c4762ed460c7bdf9a90e1d351..868bcc19caedc96bc00cce0396d12da0469dccb6 100644 (file)
@@ -575,7 +575,6 @@ bool plcollide(physent *d, const vec &dir, bool insideplayercol) {  // collide wi
                        if(o==d || d->o.reject(o->o, d->radius+o->radius)) continue;
                        if(plcollide(d, dir, o)) {
                                collideplayer = o;
-                               game::dynentcollide(d, o, collidewall);
                                return true;
                        }
                        if(collideinside > lastinside) {
@@ -586,7 +585,6 @@ bool plcollide(physent *d, const vec &dir, bool insideplayercol) {  // collide wi
        }
        if(insideplayer && insideplayercol) {
                collideplayer = insideplayer;
-               game::dynentcollide(d, insideplayer, vec(0, 0, 0));
                return true;
        }
        return false;
@@ -1325,7 +1323,7 @@ void modifyvelocity(physent *pl, bool local, bool floating, int curtime) {
                if(pl->jumping && allowmove) {
                        pl->jumping = false;
                        pl->vel.z = max(pl->vel.z, JUMPVEL); // physics impulse upwards
-                       game::physicstrigger(pl, local, 1);
+                       game::physicstrigger(pl, 1);
                }
        }
        if(!floating && pl->physstate == PHYS_FALL) pl->timeinair = min(pl->timeinair + curtime, 1000);
@@ -1400,14 +1398,14 @@ bool moveplayer(physent *pl, int moveres, bool local, int curtime) {
                d.mul(f);
                loopi(moveres) if(!move(pl, d) && ++collisions<5) i--; // discrete steps collision detection & sliding
                if(timeinair > 800 && !pl->timeinair) { // if we land after long time must have been a high jump, make thud sound {
-                       game::physicstrigger(pl, local, -1);
+                       game::physicstrigger(pl, -1);
                }
        }
        if(pl->state==CS_ALIVE) updatedynentcache(pl);
        // automatically apply smooth roll when strafing
        if(pl->strafe && maxroll) pl->roll = clamp(pl->roll - pow(clamp(1.0f + pl->strafe*pl->roll/maxroll, 0.0f, 1.0f), 0.33f)*pl->strafe*curtime*straferoll, -maxroll, maxroll);
        else pl->roll *= curtime == PHYSFRAMETIME ? faderoll : pow(faderoll, curtime/float(PHYSFRAMETIME));
-       if(pl->inwater) game::physicstrigger(pl, local, 0, pl->inwater);
+       if(pl->inwater) game::physicstrigger(pl, 0);
        pl->inwater = MAT_AIR;
        if(pl->state==CS_ALIVE && (pl->o.z < 0 || material&MAT_DEATH)) game::suicide(pl);
        return true;
index b8b28c5d844c5572ba6b93fccbcd53212852f3f9..4243ac78ac164d795bd0c77a45e88ce5b95d5100 100644 (file)
@@ -1250,4 +1250,3 @@ void cleanupgl() {
        gle::cleanup();
 }
 
-
index bc93caab716f392e302b9f140ea5c5ecd3b356b9..035521373a2cdb99db54153ccbafa4964f638ff3 100644 (file)
@@ -194,7 +194,6 @@ COMMAND(mdlname, "");
        ragdollskel *ragdoll = skel->ragdoll; \
        if(ragdoll->loaded) return;
 
-
 void rdvert(float *x, float *y, float *z, float *radius) {
        checkragdoll;
        ragdollskel::vert &v = ragdoll->verts.add();
@@ -706,7 +705,6 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
                                else if(d->type < ENT_CAMERA) pos.z += 0.75f*(d->eyeheight + d->aboveeye);
                                lightreaching(pos, light->color, light->dir, (flags&MDL_LIGHT_FAST)!=0);
                                dynlightreaching(pos, light->color, light->dir, (flags&MDL_HUD)!=0);
-                               game::lighteffects(d, light->color, light->dir);
                                light->millis = lastmillis;
                        }
                }
index cc0b65d4648578e2d2329540ba86439d7e1afe17..dada6d3d0372f1d0854fb640bd5970db6f49b403 100644 (file)
@@ -896,7 +896,6 @@ void renderzpass(renderstate &cur, vtxarray *va) {
                } \
        } while(0)
 
-
 #define endvaquery(va, flush) \
        do { \
                if(va->query) { \
index 29761e15b18535012965cf51549c6a6954cb7c54..c23e4fa0ea8ea390559dd41e1b8b4bb91aba9200 100644 (file)
@@ -5,29 +5,6 @@
 
 #define LOGSTRLEN 512
 
-static FILE *logfile = NULL;
-
-void closelogfile() {
-       if(logfile) {
-               fclose(logfile);
-               logfile = NULL;
-       }
-}
-
-FILE *getlogfile() {
-       return logfile ? logfile : stdout;
-}
-
-void setlogfile(const char *fname) {
-       closelogfile();
-       if(fname && fname[0]) {
-               fname = findfile(fname, "w");
-               if(fname) logfile = fopen(fname, "w");
-       }
-       FILE *f = getlogfile();
-       if(f) setvbuf(f, NULL, _IOLBF, BUFSIZ);
-}
-
 void logoutf(const char *fmt, ...) {
        va_list args;
        va_start(args, fmt);
@@ -35,7 +12,6 @@ void logoutf(const char *fmt, ...) {
        va_end(args);
 }
 
-
 static void writelog(FILE *file, const char *buf) {
        static uchar ubuf[512];
        size_t len = strlen(buf), carry = 0;
@@ -57,9 +33,8 @@ void fatal(const char *fmt, ...) {
        void cleanupserver();
        cleanupserver();
        defvformatstring(msg,fmt,fmt);
-       if(logfile) logoutf("%s", msg);
+       logoutf("%s", msg);
        fprintf(stderr, "server error: %s\n", msg);
-       closelogfile();
        exit(EXIT_FAILURE);
 }
 
@@ -596,7 +571,7 @@ void localconnect() {
 #endif
 
 void logoutfv(const char *fmt, va_list args) {
-       FILE *f = getlogfile();
+       FILE *f = stdout;
        if(f) writelogv(f, fmt, args);
 }
 
@@ -686,32 +661,11 @@ void stoplistenserver() {
 COMMAND(stoplistenserver, "");
 #endif
 
-bool serveroption(char *opt) {
-       switch(opt[1]) {
-               case 'u': setvar("serveruprate", atoi(opt+2)); return true;
-               case 'c': setvar("maxclients", atoi(opt+2)); return true;
-               case 'i': setsvar("serverip", opt+2); return true;
-               case 'j': setvar("serverport", atoi(opt+2)); return true;
-               case 'm': setsvar("mastername", opt+2); setvar("updatemaster", mastername[0] ? 1 : 0); return true;
-#ifdef STANDALONE
-               case 'q': logoutf("Using home directory: %s", opt); sethomedir(opt+2); return true;
-               case 'k': logoutf("Adding package directory: %s", opt); addpackagedir(opt+2); return true;
-               case 'g': logoutf("Setting log file: %s", opt); setlogfile(opt+2); return true;
-#endif
-               default: return false;
-       }
-}
-
-vector<const char *> gameargs;
-
 #ifdef STANDALONE
 int main(int argc, char **argv) {
-       setlogfile(NULL);
        if(enet_initialize()<0) fatal("Unable to initialise network module");
        atexit(enet_deinitialize);
        enet_time_set(0);
-       for(int i = 1; i<argc; i++) if(argv[i][0]!='-' || !serveroption(argv[i])) gameargs.add(argv[i]);
-       game::parseoptions(gameargs);
        initserver(true, true);
        return EXIT_SUCCESS;
 }
index 8f5e9b7823d5bf8bf9fde824ad40dac0993896bc..86e454627d64e9a359baf46076ef0f2c0e0ffb3e 100644 (file)
@@ -61,7 +61,7 @@ static void showglslinfo(GLenum type, GLuint obj, const char *name, const char *
        else glGetProgramiv_(obj, GL_INFO_LOG_LENGTH, &length);
        if(length > 1) {
                conoutf(CON_ERROR, "GLSL ERROR (%s:%s)", type == GL_VERTEX_SHADER ? "VS" : (type == GL_FRAGMENT_SHADER ? "FS" : "PROG"), name);
-               FILE *l = getlogfile();
+               FILE *l = stdout;
                if(l) {
                        GLchar *log = new GLchar[length];
                        if(type) glGetShaderInfoLog_(obj, length, &length, log);
index 742fd33b23ddff8cd90676c80b2781f2cf64647b..21cf9807bdeccbeaedc02a785317f2db8b414d01 100644 (file)
@@ -555,7 +555,6 @@ static editor *useeditor(const char *name, int mode, bool focus, const char *ini
        return e;
 }
 
-
 #define TEXTCOMMAND(f, s, d, body) ICOMMAND(f, s, d,\
        editor *top = currentfocus();\
        if(!top || identflags&IDF_OVERRIDDEN) return;\
index 489ea655482faf46f2ecaba073750f973d29b39f..f58886f34942b2765689c3f6c0cef9a2b750dc95 100644 (file)
@@ -219,11 +219,6 @@ void findents(int low, int high, bool notspawned, const vec &pos, const vec &rad
 char *entname(entity &e) {
        static string fullentname;
        copystring(fullentname, entities::entname(e.type));
-       const char *einfo = entities::entnameinfo(e);
-       if(*einfo) {
-               concatstring(fullentname, ": ");
-               concatstring(fullentname, einfo);
-       }
        return fullentname;
 }
 
@@ -286,71 +281,13 @@ void makeundoent() {
        if(u) addundo(u);
 }
 
-void detachentity(extentity &e) {
-       if(!e.attached) return;
-       e.attached->attached = NULL;
-       e.attached = NULL;
-}
-
-VAR(attachradius, 1, 100, 1000);
-
-void attachentity(extentity &e) {
-       switch(e.type) {
-               case ET_SPOTLIGHT:
-                       break;
-               default:
-                       if(e.type<ET_GAMESPECIFIC || !entities::mayattach(e)) return;
-                       break;
-       }
-       detachentity(e);
-       vector<extentity *> &ents = entities::getents();
-       int closest = -1;
-       float closedist = 1e10f;
-       loopv(ents) {
-               extentity *a = ents[i];
-               if(a->attached) continue;
-               switch(e.type) {
-                       case ET_SPOTLIGHT:
-                               if(a->type!=ET_LIGHT) continue;
-                               break;
-                       default:
-                               if(e.type<ET_GAMESPECIFIC || !entities::attachent(e, *a)) continue;
-                               break;
-               }
-               float dist = e.o.dist(a->o);
-               if(dist < closedist) {
-                       closest = i;
-                       closedist = dist;
-               }
-       }
-       if(closedist>attachradius) return;
-       e.attached = ents[closest];
-       ents[closest]->attached = &e;
-}
-
-void attachentities() {
-       vector<extentity *> &ents = entities::getents();
-       loopv(ents) attachentity(*ents[i]);
-}
-
 // convenience macros implicitly define:
 // e            entity, currently edited ent
 // n            int,   index to currently edited ent
 #define addimplicit(f) { if(entgroup.empty() && enthover>=0) { entadd(enthover); undonext = (enthover != oldhover); f; entgroup.drop(); } else f; }
-#define entfocusv(i, f, v){ int n = efocus = (i); if(n>=0) { extentity &e = *v[n]; f; } }
+#define entfocusv(i, f, v){ int n = efocus = (i); if(n>=0) { extentity &e = *v[n]; f; (void) e; } }
 #define entfocus(i, f) entfocusv(i, f, entities::getents())
-#define enteditv(i, f, v) { \
- \
-       entfocusv(i, { \
-        \
-               int oldtype = e.type; \
-               removeentity(n);  \
-               f; \
-               if(oldtype!=e.type) detachentity(e); \
-               if(e.type!=ET_EMPTY) { addentity(n); if(oldtype!=e.type) attachentity(e); } \
-               entities::editent(n, true); \
-       }, v); \
-}
+#define enteditv(i, f, v) { entfocusv(i, { int a = 0; (void) a; }, v); }
 #define entedit(i, f)   enteditv(i, f, entities::getents())
 #define addgroup(exp)  {  vector<extentity *> &ents = entities::getents(); loopv(ents) entfocusv(i, if(exp) entadd(n), ents); }
 #define setgroup(exp)  {  entcancel(); addgroup(exp); }
@@ -490,15 +427,6 @@ void renderentsphere(const extentity &e, float radius) {
        loopk(3) renderentring(e, radius, k);
 }
 
-void renderentattachment(const extentity &e) {
-       if(!e.attached) return;
-       gle::defvertex();
-       gle::begin(GL_LINES);
-       gle::attrib(e.o);
-       gle::attrib(e.attached->o);
-       xtraverts += gle::end();
-}
-
 void renderentarrow(const extentity &e, const vec &dir, float radius) {
        if(radius <= 0) return;
        float arrowsize = min(radius/8, 0.5f);
@@ -541,17 +469,6 @@ void renderentradius(extentity &e, bool color) {
                        if(color) gle::colorf(e.attr2/255.0f, e.attr3/255.0f, e.attr4/255.0f);
                        renderentsphere(e, e.attr1);
                        break;
-               case ET_SPOTLIGHT:
-                       if(e.attached) {
-                               if(color) gle::colorf(0, 1, 1);
-                               float radius = e.attached->attr1;
-                               if(!radius) radius = 2*e.o.dist(e.attached->o);
-                               vec dir = vec(e.o).sub(e.attached->o).normalize();
-                               float angle = clamp(int(e.attr1), 1, 89);
-                               renderentattachment(e);
-                               renderentcone(*e.attached, dir, radius, angle);
-                       }
-                       break;
                case ET_SOUND:
                        if(color) gle::colorf(0, 1, 1);
                        renderentsphere(e, e.attr2);
@@ -559,7 +476,7 @@ void renderentradius(extentity &e, bool color) {
                case ET_MAPMODEL:
                case ET_PLAYERSTART: {
                        if(color) gle::colorf(0, 1, 1);
-                       entities::entradius(e, color);
+                       entities::entradius(e);
                        vec dir;
                        vecfromyawpitch(e.attr1, 0, 1, 0, dir);
                        renderentarrow(e, dir, 4);
@@ -568,7 +485,7 @@ void renderentradius(extentity &e, bool color) {
                default:
                        if(e.type>=ET_GAMESPECIFIC) {
                                if(color) gle::colorf(0, 1, 1);
-                               entities::entradius(e, color);
+                               entities::entradius(e);
                        }
                        break;
        }
@@ -744,8 +661,7 @@ bool dropentity(entity &e, int drop = -1) {
        }
        switch(drop) {
        case 1:
-               if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT)
-                       dropenttofloor(&e);
+               dropenttofloor(&e);
                break;
        case 2:
        case 3:
@@ -774,13 +690,6 @@ void dropent() {
        groupedit(dropentity(e));
 }
 
-void attachent() {
-       if(noentedit()) return;
-       groupedit(attachentity(e));
-}
-
-COMMAND(attachent, "");
-
 VARP(entcamdir, 0, 1, 1);
 
 static int keepents = 0;
@@ -881,24 +790,7 @@ void entset(char *what, int *a1, int *a2, int *a3, int *a4, int *a5) {
        if(noentedit()) return;
        int type = findtype(what);
        if(type != ET_EMPTY)
-               groupedit(e.type=type;
-                                 e.attr1=*a1;
-                                 e.attr2=*a2;
-                                 e.attr3=*a3;
-                                 e.attr4=*a4;
-                                 e.attr5=*a5);
-}
-
-void printent(extentity &e, char *buf, int len) {
-       switch(e.type) {
-               case ET_PARTICLES:
-                       if(printparticles(e, buf, len)) return;
-                       break;
-               default:
-                       if(e.type >= ET_GAMESPECIFIC && entities::printent(e, buf, len)) return;
-                       break;
-       }
-       nformatstring(buf, len, "%s %d %d %d %d %d", entities::entname(e.type), e.attr1, e.attr2, e.attr3, e.attr4, e.attr5);
+               groupedit(e.type=type; e.attr1=*a1; e.attr2=*a2; e.attr3=*a3; e.attr4=*a4; e.attr5=*a5);
 }
 
 void nearestent() {
@@ -922,7 +814,6 @@ ICOMMAND(enthavesel,"",  (), addimplicit(intret(entgroup.length())));
 ICOMMAND(entselect, "e", (uint *body), if(!noentedit()) addgroup(e.type != ET_EMPTY && entgroup.find(n)<0 && executebool(body)));
 ICOMMAND(entloop,   "e", (uint *body), if(!noentedit()) addimplicit(groupeditloop(((void)e, execute(body)))));
 ICOMMAND(insel,         "",  (), entfocus(efocus, intret(pointinsel(sel, e.o))));
-ICOMMAND(entget,       "",  (), entfocus(efocus, string s; printent(e, s, sizeof(s)); result(s)));
 ICOMMAND(entindex,  "",  (), intret(efocus));
 COMMAND(entset, "siiiii");
 COMMAND(nearestent, "");
@@ -1153,18 +1044,6 @@ void mpeditent(int i, const vec &o, int type, int attr1, int attr2, int attr3, i
                extentity *e = newentity(local, o, type, attr1, attr2, attr3, attr4, attr5, i);
                if(!e) return;
                addentity(i);
-               attachentity(*e);
-       }
-       else {
-               extentity &e = *ents[i];
-               removeentity(i);
-               int oldtype = e.type;
-               if(oldtype!=type) detachentity(e);
-               e.type = type;
-               e.o = o;
-               e.attr1 = attr1; e.attr2 = attr2; e.attr3 = attr3; e.attr4 = attr4; e.attr5 = attr5;
-               addentity(i);
-               if(oldtype!=type) attachentity(e);
        }
        entities::editent(i, local);
 }
index 898b2bb6a4c0b35775eb1113031c2b7ce8fda5a4..e64e0da2f09d213bd31290b4397c3b3389d18ea8 100644 (file)
@@ -556,11 +556,8 @@ bool save_world(const char *mname, bool nolms) {
                                break;
                }
        });
-       f->putchar((int)strlen(game::gameident()));
-       f->write(game::gameident(), (int)strlen(game::gameident())+1);
        f->putlil<ushort>(entities::extraentinfosize());
        vector<char> extras;
-       game::writegamedata(extras);
        f->putlil<ushort>(extras.length());
        f->write(extras.getbuf(), extras.length());
        f->putlil<ushort>(texmru.length());
@@ -615,7 +612,6 @@ bool load_world(const char *mname, const char *cname) {             // still supports all m
        resetmap();
        Texture *mapshot = textureload(picname, 3, true, false);
        renderbackground("loading...", mapshot, mname, game::getmapinfo());
-       game::loadingmap(cname ? cname : mname);
        setvar("mapversion", hdr.version, true, false);
        lilswap(&hdr.numvslots, 1);
        renderprogress(0, "clearing world...");
@@ -663,7 +659,6 @@ bool load_world(const char *mname, const char *cname) {             // still supports all m
        int extrasize = f->getlil<ushort>();
        vector<char> extras;
        f->read(extras.pad(extrasize), extrasize);
-       game::readgamedata(extras);
        texmru.shrink(0);
        ushort nummru = f->getlil<ushort>();
        loopi(nummru) texmru.add(f->getlil<ushort>());
@@ -679,9 +674,7 @@ bool load_world(const char *mname, const char *cname) {             // still supports all m
                lilswap(&e.attr1, 5);
                if(einfosize > 0) f->read(ebuf, einfosize);
                if(!insideworld(e.o)) {
-                       if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT) {
-                               conoutf(CON_WARN, "warning: ent outside of world: enttype[%s] index %d (%f, %f, %f)", entities::entname(e.type), i, e.o.x, e.o.y, e.o.z);
-                       }
+                       conoutf(CON_WARN, "warning: ent outside of world: enttype[%s] index %d (%f, %f, %f)", entities::entname(e.type), i, e.o.x, e.o.y, e.o.z);
                }
        }
        if(ebuf) delete[] ebuf;
@@ -727,7 +720,6 @@ bool load_world(const char *mname, const char *cname) {             // still supports all m
        flushpreloadedmodels();
        preloadmapsounds();
        entitiesinoctanodes();
-       attachentities();
        initlights();
        allchanged(true);
        renderbackground("loading...", mapshot, mname, game::getmapinfo());
index b6db1fce5bf26ca8e177c21a3ba3f76b05a67d3a..40c8513a30330b6636a5f6c06c49c6aece39e921 100644 (file)
@@ -236,4 +236,3 @@ namespace ai {
        extern void render();
 }
 
-
index 9336c4e56d94704f8f08724f92f33ea7420494e6..21d44a6d13cf6a6a3266b6721e4b6693e137c44f 100644 (file)
@@ -9,8 +9,6 @@ namespace entities {
 #ifndef STANDALONE
        vector<extentity *> ents;
        vector<extentity *> &getents() { return ents; }
-       bool mayattach(extentity &e) { return false; }
-       bool attachent(extentity &e, extentity &a) { return false; }
        const char *itemname(int i) {
                int t = ents[i]->type;
                if(t<I_SHELLS || t>I_QUAD) return NULL;
@@ -306,7 +304,7 @@ namespace entities {
        void fixentity(extentity &e) {
                if(e.type == TELEDEST) e.attr3 = e.attr2;
        }
-       void entradius(extentity &e, bool color) {
+       void entradius(extentity &e) {
                switch(e.type) {
                        case TELEDEST: {
                                vec dir;
@@ -326,13 +324,9 @@ namespace entities {
                        default: break;
                }
        }
-       bool printent(extentity &e, char *buf, int len) {
-               return false;
-       }
-       const char *entnameinfo(entity &e) { return ""; }
        const char *entname(int i) {
                static const char * const entnames[] = {
-                       "none?", "light", "mapmodel", "playerstart", "none?", "particles", "sound", "spotlight",
+                       "none?", "light", "mapmodel", "playerstart", "none?", "particles", "sound",
                        "shells", "bullets", "rockets", "riflerounds", "grenades", "cartridges",
                        "health", "healthboost", "tinyhealth", "tinyarmour", "greenarmour", "yellowarmour", "quaddamage",
                        "teleport", "teledest",
@@ -345,7 +339,5 @@ namespace entities {
                extentity &e = *ents[i];
                if(local) addmsg(N_EDITENT, "rii3ii5", i, (int)(e.o.x*DMF), (int)(e.o.y*DMF), (int)(e.o.z*DMF), e.type, e.attr1, e.attr2, e.attr3, e.attr4, e.attr5);
        }
-
 #endif
 }
-
index c74f5f437325bc058d9dc60a25f24b0340fdf535..eadb2c8fa15826c04b164dc5c6281e53e4dc2451 100644 (file)
@@ -9,7 +9,6 @@ namespace game {
        fpsent *player1 = NULL;          // our client
        vector<fpsent *> players;          // other clients
        int savedammo[NUMGUNS];
-       bool clientoption(const char *arg) { return false; }
        void taunt() {
                if(player1->state!=CS_ALIVE || player1->physstate<PHYS_SLOPE) return;
                if(lastmillis-player1->lasttaunt<1000) return;
@@ -454,9 +453,6 @@ namespace game {
                lasthit = 0;
                execident("mapstart");
        }
-       void loadingmap(const char *name) {
-               execident("playsong");
-       }
        void startmap(const char *name) {   // called just after a map load {
                pwreset();
                ai::savewaypoints();
@@ -474,14 +470,11 @@ namespace game {
        const char *getscreenshotinfo() {
                return server::modename(gamemode, NULL);
        }
-       void physicstrigger(physent *d, bool local, int floorlevel, int material) {
+       void physicstrigger(physent *d, int floorlevel) {
                if(d->type==ENT_INANIMATE) return;
-               if       (floorlevel>0) { if(d==player1 || d->type!=ENT_PLAYER || ((fpsent *)d)->ai) msgsound(S_JUMP, d); }
+               if (floorlevel>0) { if(d==player1 || d->type!=ENT_PLAYER || ((fpsent *)d)->ai) msgsound(S_JUMP, d); }
                else if(floorlevel<0) { if(d==player1 || d->type!=ENT_PLAYER || ((fpsent *)d)->ai) msgsound(S_LAND, d); }
        }
-       void dynentcollide(physent *d, physent *o, const vec &dir) {
-               return;
-       }
        void msgsound(int n, physent *d) {
                if(!d || d==player1) {
                        addmsg(N_SOUND, "ci", d, n);
@@ -564,6 +557,7 @@ namespace game {
                gle::end();
        }
        float abovegameplayhud(int w, int h) {
+               (void)w;(void)h;
                switch(hudplayer()->state) {
                        case CS_EDITING:
                        case CS_SPECTATOR:
@@ -888,9 +882,6 @@ namespace game {
                        pophudmatrix();
                }
        }
-       int clipconsole(int w, int h) {
-               return 0;
-       }
        VARP(teamcrosshair, 0, 1, 1);
        VARP(hitcrosshair, 0, 425, 1000);
        const char *defaultcrosshair(int index) {
@@ -920,15 +911,6 @@ namespace game {
                if(d->gunwait) color.mul(0.5f);
                return crosshair;
        }
-       void lighteffects(dynent *e, vec &color, vec &dir) {
-#if 0
-               fpsent *d = (fpsent *)e;
-               if(d->state!=CS_DEAD && d->quadmillis) {
-                       float t = 0.5f + 0.5f*sinf(2*M_PI*lastmillis/1000.0f);
-                       color.y = color.y*(1-t) + t;
-               }
-#endif
-       }
        int maxsoundradius(int n) {
                switch(n) {
                        case S_JUMP:
@@ -1038,8 +1020,6 @@ namespace game {
                return false;
        }
        // any data written into this vector will get saved with the map data. Must take care to do own versioning, and endianess if applicable. Will not get called when loading maps from other games, so provide defaults.
-       void writegamedata(vector<char> &extras) {}
-       void readgamedata(vector<char> &extras) {}
        const char *savedconfig() { return "config.cfg"; }
        const char *restoreconfig() { return "restore.cfg"; }
        const char *defaultconfig() { return "data/defaults.cfg"; }
index 974f1f30ff8777281cc66f79817d8bcfd995eaa7..dadebd566a3cd23783fffc94d1feb7a66ab5ae4a 100644 (file)
@@ -26,7 +26,6 @@ enum {                                                        // static entity types {
        PLAYERSTART,                            // attr1 = angle, attr2 = team
        PARTICLES = ET_PARTICLES,
        MAPSOUND = ET_SOUND,
-       SPOTLIGHT = ET_SPOTLIGHT,
        I_SHELLS, I_BULLETS, I_ROCKETS, I_ROUNDS, I_GRENADES, I_CARTRIDGES,
        I_HEALTH, I_BOOST,
        /**/I_TINYHEALTH, I_TINYARMOUR,
@@ -510,7 +509,6 @@ namespace game {
        extern int respawnent;
        extern int following;
        extern int smoothmove, smoothdist;
-       extern bool clientoption(const char *arg);
        extern fpsent *getclient(int cn);
        extern fpsent *newclient(int cn);
        extern const char *colorname(fpsent *d, const char *name = NULL, const char *prefix = "", const char *suffix = "", const char *alt = NULL);
@@ -613,7 +611,6 @@ namespace server {
        extern void forcegamespeed(int speed);
        extern void hashpassword(int cn, int sessionid, const char *pwd, char *result, int maxlen = MAXSTRLEN);
        extern int msgsizelookup(int msg);
-       extern bool serveroption(const char *arg);
        extern bool delayspawn(int type);
 }
 
index 81f93a14eabdeed4345a4912256f8ab7ddd78909..b1c74774a1151ffba038ad004a3367bc88d0eb07 100644 (file)
@@ -112,6 +112,7 @@ namespace game {
                return color;
        }
        void renderscoreboard(g3d_gui &g, bool firstpass) {
+               (void) firstpass;
                const ENetAddress *address = connectedpeer();
                if(showservinfo && address) {
                        string hostname;
index 2095dd1fac107ee3f9d7ba73ec516888083751be..7070fb873052dacb53a713d34f9f4e61856cb003 100644 (file)
@@ -1,17 +1,5 @@
 #include "game.h"
 
-namespace game {
-       void parseoptions(vector<const char *> &args) {
-               loopv(args)
-#ifndef STANDALONE
-                       if(!game::clientoption(args[i]))
-#endif
-                       if(!server::serveroption(args[i]))
-                               conoutf(CON_ERROR, "unknown command-line option: %s", args[i]);
-       }
-       const char *gameident() { return "fps"; }
-}
-
 VAR(regenbluearmour, 0, 1, 1);
 
 extern ENetAddress masteraddress;
@@ -573,15 +561,6 @@ namespace server {
                sents.setsize(0);
                //cps.reset();
        }
-       bool serveroption(const char *arg) {
-               if(arg[0]=='-') switch(arg[1]) {
-                       case 'n': setsvar("serverdesc", &arg[2]); return true;
-                       case 'y': setsvar("serverpass", &arg[2]); return true;
-                       case 'p': setsvar("adminpass", &arg[2]); return true;
-                       case 'o': setvar("publicserver", atoi(&arg[2])); return true;
-               }
-               return false;
-       }
        void serverinit() {
                smapname[0] = '\0';
                resetitems();
index 6b1dfcaf6a156e269d4723ca020e31ef0ec0eb1d..fece7bf033f9840654a684451463020fd71f11d6 100644 (file)
@@ -3,7 +3,7 @@
 
 // ET_*: the only static entity types dictated by the engine... rest are gamecode dependent
 
-enum { ET_EMPTY=0, ET_LIGHT, ET_MAPMODEL, ET_PLAYERSTART, ET_PARTICLES, ET_SOUND, ET_SPOTLIGHT, ET_GAMESPECIFIC };
+enum { ET_EMPTY=0, ET_LIGHT, ET_MAPMODEL, ET_PLAYERSTART, ET_PARTICLES, ET_SOUND, ET_GAMESPECIFIC };
 
 // persistent map entity
 struct entity {
@@ -35,8 +35,7 @@ enum {
 struct extentity : entity {
        int flags;  // the only dynamic state of a map entity
        entitylight light;
-       extentity *attached;
-       extentity() : flags(0), attached(NULL) {}
+       extentity() : flags(0) {}
        bool spawned() const { return (flags&EF_SPAWNED) != 0; }
        void setspawned(bool val) { if(val) flags |= EF_SPAWNED; else flags &= ~EF_SPAWNED; }
        void setspawned() { flags |= EF_SPAWNED; }
index ad7184189cfab19a9d6a16237075e1b63db88c01..13a75dc468fd37c639071f8b354d454f88e01567 100644 (file)
@@ -235,4 +235,3 @@ extern const vec2 sincos360[721] = {
        vec2(0.99452190, -0.10452846), vec2(0.99619470, -0.08715574), vec2(0.99756405, -0.06975647), vec2(0.99862953, -0.05233596), vec2(0.99939083, -0.03489950), vec2(0.99984770, -0.01745241), // 714
        vec2(1.00000000, 0.00000000) // 720
 };
-
index f4e822dc5db48aad1a03cce736e0491685d01e99..3b2c662f76fa431923b06fbd1e8ffb5ffe9c1e05 100644 (file)
@@ -186,9 +186,6 @@ extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3);
 extern void conoutf(int type, int tag, const char *s, ...) PRINTFARGS(3, 4);
 extern void conoutfv(int type, const char *fmt, va_list args);
 
-extern FILE *getlogfile();
-extern void setlogfile(const char *fname);
-extern void closelogfile();
 extern void logoutfv(const char *fmt, va_list args);
 extern void logoutf(const char *fmt, ...) PRINTFARGS(1, 2);
 
@@ -222,7 +219,6 @@ extern int getworldsize();
 extern int getmapversion();
 extern void renderentcone(const extentity &e, const vec &dir, float radius, float angle);
 extern void renderentarrow(const extentity &e, const vec &dir, float radius);
-extern void renderentattachment(const extentity &e);
 extern void renderentsphere(const extentity &e, float radius);
 extern void renderentring(const extentity &e, float radius, int axis = 0);
 
index 03a91633099f286ca226ac9ddb8ef7cc94d65a62..4b0e933685c90de82bf7b507465feba706047ce5 100644 (file)
@@ -2,14 +2,10 @@
 
 namespace entities {
        extern void editent(int i, bool local);
-       extern const char *entnameinfo(entity &e);
        extern const char *entname(int i);
        extern int extraentinfosize();
        extern void fixentity(extentity &e);
-       extern void entradius(extentity &e, bool color);
-       extern bool mayattach(extentity &e);
-       extern bool attachent(extentity &e, extentity &a);
-       extern bool printent(extentity &e, char *buf, int len);
+       extern void entradius(extentity &e);
        extern extentity *newentity();
        extern void deleteentity(extentity *e);
        extern void clearents();
@@ -18,7 +14,6 @@ namespace entities {
 }
 
 namespace game {
-       extern void parseoptions(vector<const char *> &args);
        extern void gamedisconnect(bool cleanup);
        extern void parsepacketclient(int chan, packetbuf &p);
        extern void connectattempt(const char *name, const char *password, const ENetAddress &address);
@@ -33,7 +28,6 @@ namespace game {
        extern bool ispaused();
        extern int scaletime(int t);
        extern bool allowmouselook();
-       extern const char *gameident();
        extern const char *savedconfig();
        extern const char *restoreconfig();
        extern const char *defaultconfig();
@@ -42,11 +36,10 @@ namespace game {
        extern void loadconfigs();
        extern void updateworld();
        extern void initclient();
-       extern void physicstrigger(physent *d, bool local, int floorlevel, int material = 0);
+       extern void physicstrigger(physent *d, int floorlevel);
        extern void bounced(physent *d, const vec &surface);
        extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = NULL);
        extern void vartrigger(ident *id);
-       extern void dynentcollide(physent *d, physent *o, const vec &dir);
        extern const char *getclientmap();
        extern const char *getmapinfo();
        extern const char *getscreenshotinfo();
@@ -54,7 +47,6 @@ namespace game {
        extern void suicide(physent *d);
        extern float ratespawn(dynent *d, const extentity &e);
        extern void newmap(int size);
-       extern void loadingmap(const char *name);
        extern void startmap(const char *name);
        extern void preload();
        extern float abovegameplayhud(int w, int h);
@@ -67,13 +59,9 @@ namespace game {
        extern void rendergame(bool mainpass);
        extern void renderavatar();
        extern void renderplayerpreview(int model, int team, int weap);
-       extern void writegamedata(vector<char> &extras);
-       extern void readgamedata(vector<char> &extras);
-       extern int clipconsole(int w, int h);
        extern void g3d_gamemenus();
        extern const char *defaultcrosshair(int index);
        extern int selectcrosshair(vec &color);
-       extern void lighteffects(dynent *d, vec &color, vec &dir);
        extern void setupcamera();
        extern bool allowthirdperson(bool msg = false);
        extern bool detachcamera();
index 18788016e08721fa5edbd7664ce48d35afa0feb9..3a5c6e238e3b2131401e30161b24bcc4cb47413c 100644 (file)
@@ -232,7 +232,6 @@ done:
 #include <sys/types.h>
 #include <dirent.h>
 
-string homedir = "";
 struct packagedir {
        char *dir, *filter;
        size_t dirlen, filterlen;
@@ -260,7 +259,6 @@ char *makerelpath(const char *dir, const char *file, const char *prefix, const c
        return tmp;
 }
 
-
 char *path(char *s) {
        for(char *curpart = s;;) {
                char *endpart = strchr(curpart, '&');
@@ -330,75 +328,8 @@ bool createdir(const char *path) {
        return mkdir(path, 0777)==0;
 }
 
-size_t fixpackagedir(char *dir) {
-       path(dir);
-       size_t len = strlen(dir);
-       if(len > 0 && dir[len-1] != PATHDIV) {
-               dir[len] = PATHDIV;
-               dir[len+1] = '\0';
-       }
-       return len;
-}
-
-bool subhomedir(char *dst, int len, const char *src) {
-       const char *sub = strstr(src, "$HOME");
-       if(!sub) sub = strchr(src, '~');
-       if(sub && sub-src < len) {
-               const char *home = getenv("HOME");
-               if(!home || !home[0]) return false;
-               dst[sub-src] = '\0';
-               concatstring(dst, home, len);
-               concatstring(dst, sub+(*sub == '~' ? 1 : strlen("$HOME")), len);
-       }
-       return true;
-}
-
-const char *sethomedir(const char *dir) {
-       string pdir;
-       copystring(pdir, dir);
-       if(!subhomedir(pdir, sizeof(pdir), dir) || !fixpackagedir(pdir)) return NULL;
-       copystring(homedir, pdir);
-       return homedir;
-}
-
-const char *addpackagedir(const char *dir) {
-       string pdir;
-       copystring(pdir, dir);
-       if(!subhomedir(pdir, sizeof(pdir), dir) || !fixpackagedir(pdir)) return NULL;
-       char *filter = pdir;
-       for(;;) {
-               static int len = strlen("packages");
-               filter = strstr(filter, "packages");
-               if(!filter) break;
-               if(filter > pdir && filter[-1] == PATHDIV && filter[len] == PATHDIV) break;
-               filter += len;
-       }
-       packagedir &pf = packagedirs.add();
-       pf.dir = filter ? newstring(pdir, filter-pdir) : newstring(pdir);
-       pf.dirlen = filter ? filter-pdir : strlen(pdir);
-       pf.filter = filter ? newstring(filter) : NULL;
-       pf.filterlen = filter ? strlen(filter) : 0;
-       return pf.dir;
-}
-
 const char *findfile(const char *filename, const char *mode) {
        static string s;
-       if(homedir[0]) {
-               formatstring(s, "%s%s", homedir, filename);
-               if(fileexists(s, mode)) return s;
-               if(mode[0]=='w' || mode[0]=='a') {
-                       string dirs;
-                       copystring(dirs, s);
-                       char *dir = strchr(dirs[0]==PATHDIV ? dirs+1 : dirs, PATHDIV);
-                       while(dir) {
-                               *dir = '\0';
-                               if(!fileexists(dirs, "d") && !createdir(dirs)) return s;
-                               *dir = PATHDIV;
-                               dir = strchr(dir+1, PATHDIV);
-                       }
-                       return s;
-               }
-       }
        if(mode[0]=='w' || mode[0]=='a') return filename;
        loopv(packagedirs) {
                packagedir &pf = packagedirs[i];
@@ -442,10 +373,8 @@ int listfiles(const char *dir, const char *ext, vector<char *> &files) {
        int dirs = 0;
        if(listdir(dirname, true, ext, files)) dirs++;
        string s;
-       if(homedir[0]) {
-               formatstring(s, "%s%s", homedir, dirname);
-               if(listdir(s, false, ext, files)) dirs++;
-       }
+       formatstring(s, "%s%s", ".", dirname);
+       if(listdir(s, false, ext, files)) dirs++;
        loopv(packagedirs) {
                packagedir &pf = packagedirs[i];
                if(pf.filter && strncmp(dirname, pf.filter, dirlen == pf.filterlen-1 ? dirlen : pf.filterlen))
index 709f056c590e75fe3f90e82b7415db4837dec13d..6e7eeab806b7b9e1bd7c50b58995907401312b5f 100644 (file)
@@ -1012,17 +1012,12 @@ static inline uchar cubeupper(uchar c) {
 extern size_t decodeutf8(uchar *dst, size_t dstlen, const uchar *src, size_t srclen, size_t *carry = NULL);
 extern size_t encodeutf8(uchar *dstbuf, size_t dstlen, const uchar *srcbuf, size_t srclen, size_t *carry = NULL);
 
-extern string homedir;
-
 extern char *makerelpath(const char *dir, const char *file, const char *prefix = NULL, const char *cmd = NULL);
 extern char *path(char *s);
 extern char *path(const char *s, bool copy);
 extern const char *parentdir(const char *directory);
 extern bool fileexists(const char *path, const char *mode);
 extern bool createdir(const char *path);
-extern size_t fixpackagedir(char *dir);
-extern const char *sethomedir(const char *dir);
-extern const char *addpackagedir(const char *dir);
 extern const char *findfile(const char *filename, const char *mode);
 extern bool findzipfile(const char *filename);
 extern stream *openrawfile(const char *filename, const char *mode);
index c60ea168a40e1aab0c222f9c68f2ff03e9f43f40..98ac8fbe9d308a7323dd34875584c0f8141a8bf4 100644 (file)
@@ -200,7 +200,6 @@ static void mountzip(ziparchive &arch, vector<zipfile> &files, const char *mount
        string mdir = "", fname;
        if(mountdir) {
                copystring(mdir, mountdir);
-               if(fixpackagedir(mdir) <= 1) mdir[0] = '\0';
        }
        loopv(files) {
                zipfile &f = files[i];