diff options
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/console.cpp | 2 | ||||
| -rw-r--r-- | src/engine/engine.h | 5 | ||||
| -rw-r--r-- | src/engine/lightmap.cpp | 18 | ||||
| -rw-r--r-- | src/engine/main.cpp | 47 | ||||
| -rw-r--r-- | src/engine/master.cpp | 14 | ||||
| -rw-r--r-- | src/engine/menus.cpp | 1 | ||||
| -rw-r--r-- | src/engine/octaedit.cpp | 1 | ||||
| -rw-r--r-- | src/engine/physics.cpp | 8 | ||||
| -rw-r--r-- | src/engine/rendergl.cpp | 1 | ||||
| -rw-r--r-- | src/engine/rendermodel.cpp | 2 | ||||
| -rw-r--r-- | src/engine/renderva.cpp | 1 | ||||
| -rw-r--r-- | src/engine/server.cpp | 50 | ||||
| -rw-r--r-- | src/engine/shader.cpp | 2 | ||||
| -rw-r--r-- | src/engine/textedit.h | 1 | ||||
| -rw-r--r-- | src/engine/world.cpp | 133 | ||||
| -rw-r--r-- | src/engine/worldio.cpp | 10 |
16 files changed, 20 insertions, 276 deletions
diff --git a/src/engine/console.cpp b/src/engine/console.cpp index 1386570..b770bd1 100644 --- a/src/engine/console.cpp +++ b/src/engine/console.cpp @@ -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); diff --git a/src/engine/engine.h b/src/engine/engine.h index 7bc0ef1..f50a558 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -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); diff --git a/src/engine/lightmap.cpp b/src/engine/lightmap.cpp index 1481de9..0a9daf1 100644 --- a/src/engine/lightmap.cpp +++ b/src/engine/lightmap.cpp @@ -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; diff --git a/src/engine/main.cpp b/src/engine/main.cpp index a059c13..5e3b1c8 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -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(); diff --git a/src/engine/master.cpp b/src/engine/master.cpp index c1d3e20..92d1b97 100644 --- a/src/engine/master.cpp +++ b/src/engine/master.cpp @@ -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(;;) { diff --git a/src/engine/menus.cpp b/src/engine/menus.cpp index e2bd266..e91c6a2 100644 --- a/src/engine/menus.cpp +++ b/src/engine/menus.cpp @@ -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(); diff --git a/src/engine/octaedit.cpp b/src/engine/octaedit.cpp index 0da305d..7947e67 100644 --- a/src/engine/octaedit.cpp +++ b/src/engine/octaedit.cpp @@ -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); diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp index a43e8b4..868bcc1 100644 --- a/src/engine/physics.cpp +++ b/src/engine/physics.cpp @@ -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; diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp index b8b28c5..4243ac7 100644 --- a/src/engine/rendergl.cpp +++ b/src/engine/rendergl.cpp @@ -1250,4 +1250,3 @@ void cleanupgl() { gle::cleanup(); } - diff --git a/src/engine/rendermodel.cpp b/src/engine/rendermodel.cpp index bc93caa..0355213 100644 --- a/src/engine/rendermodel.cpp +++ b/src/engine/rendermodel.cpp @@ -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; } } diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp index cc0b65d..dada6d3 100644 --- a/src/engine/renderva.cpp +++ b/src/engine/renderva.cpp @@ -896,7 +896,6 @@ void renderzpass(renderstate &cur, vtxarray *va) { } \ } while(0) - #define endvaquery(va, flush) \ do { \ if(va->query) { \ diff --git a/src/engine/server.cpp b/src/engine/server.cpp index 29761e1..c23e4fa 100644 --- a/src/engine/server.cpp +++ b/src/engine/server.cpp @@ -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; } diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp index 8f5e9b7..86e4546 100644 --- a/src/engine/shader.cpp +++ b/src/engine/shader.cpp @@ -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); diff --git a/src/engine/textedit.h b/src/engine/textedit.h index 742fd33..21cf980 100644 --- a/src/engine/textedit.h +++ b/src/engine/textedit.h @@ -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;\ diff --git a/src/engine/world.cpp b/src/engine/world.cpp index 489ea65..f58886f 100644 --- a/src/engine/world.cpp +++ b/src/engine/world.cpp @@ -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); } diff --git a/src/engine/worldio.cpp b/src/engine/worldio.cpp index 898b2bb..e64e0da 100644 --- a/src/engine/worldio.cpp +++ b/src/engine/worldio.cpp @@ -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()); |
