diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 3e40e010..d57ee58d 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -171,7 +171,7 @@ void parsemessages(int cn, dynent *d, ucharbuf &p) conoutf("INFO: this server is password protected"); addmsg(SV_PWD, "rs", clientpassword); }; - if(firstplayer) changemap(getclientmap()); // we are the first client on this server, set map + if(firstplayer && getclientmap()[0]) changemap(getclientmap()); // we are the first client on this server, set map break; }; diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index 65c94a3a..98848629 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -58,10 +58,10 @@ void render_particles(int time) glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA); glDisable(GL_FOG); - static Texture *parttex[4] = {NULL, NULL, NULL, NULL}; + static Texture *parttex[2] = {NULL, NULL}; if(!parttex[0]) parttex[0] = textureload("packages/misc/base.png"); if(!parttex[1]) parttex[1] = textureload("packages/misc/smoke.png"); - struct parttype { float r, g, b; int gr, tex; float sz; } parttypes[] = + static struct parttype { float r, g, b; int gr, tex; float sz; } parttypes[] = { { 0.2f, 0.2f, 0.2f, 2, 0, 0.06f }, // yellow: sparks { 0.5f, 0.5f, 0.5f, 20, 1, 0.15f }, // grey: small smoke diff --git a/source/src/rendertext.cpp b/source/src/rendertext.cpp index befe8264..d1c1caf1 100644 --- a/source/src/rendertext.cpp +++ b/source/src/rendertext.cpp @@ -140,8 +140,11 @@ void draw_textf(const char *fstr, int left, int top, ...) void draw_text(const char *str, int left, int top) { + static Texture *charstex = NULL; + if(!charstex) charstex = textureload("packages/misc/newchars.png"); + glBlendFunc(GL_ONE, GL_ONE); - glBindTexture(GL_TEXTURE_2D, 2); + glBindTexture(GL_TEXTURE_2D, charstex->id); glColor3ub(255,255,255); int x = left; @@ -182,13 +185,31 @@ void draw_text(const char *str, int left, int top) // also Don's code, so goes in here too :) +static Texture *sky[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; + +void loadsky(char *basename) +{ + static string lastsky = ""; + if(strcmp(lastsky, basename)==0) return; + char *side[] = { "ft", "bk", "lf", "rt", "dn", "up" }; + loopi(6) + { + s_sprintfd(name)("packages/%s_%s.jpg", basename, side[i]); + sky[i] = textureload(name, true); + if(!sky[i]) conoutf("could not load sky textures"); + }; + s_strcpy(lastsky, basename); +}; + +COMMAND(loadsky, ARG_1STR); + void draw_envbox_aux(float s0, float t0, int x0, int y0, int z0, float s1, float t1, int x1, int y1, int z1, float s2, float t2, int x2, int y2, int z2, float s3, float t3, int x3, int y3, int z3, - int texture) + Texture *tex) { - glBindTexture(GL_TEXTURE_2D, texture); + glBindTexture(GL_TEXTURE_2D, tex->id); glBegin(GL_QUADS); glTexCoord2f(s3, t3); glVertex3d(x3, y3, z3); glTexCoord2f(s2, t2); glVertex3d(x2, y2, z2); @@ -198,39 +219,41 @@ void draw_envbox_aux(float s0, float t0, int x0, int y0, int z0, xtraverts += 4; } -void draw_envbox(int t, int w) +void draw_envbox(int w) { + if(!sky[0]) return; + glDepthMask(GL_FALSE); draw_envbox_aux(1.0f, 1.0f, -w, -w, w, 0.0f, 1.0f, w, -w, w, 0.0f, 0.0f, w, -w, -w, - 1.0f, 0.0f, -w, -w, -w, t); + 1.0f, 0.0f, -w, -w, -w, sky[0]); draw_envbox_aux(1.0f, 1.0f, +w, w, w, 0.0f, 1.0f, -w, w, w, 0.0f, 0.0f, -w, w, -w, - 1.0f, 0.0f, +w, w, -w, t+1); + 1.0f, 0.0f, +w, w, -w, sky[1]); draw_envbox_aux(0.0f, 0.0f, -w, -w, -w, 1.0f, 0.0f, -w, w, -w, 1.0f, 1.0f, -w, w, w, - 0.0f, 1.0f, -w, -w, w, t+2); + 0.0f, 1.0f, -w, -w, w, sky[2]); draw_envbox_aux(1.0f, 1.0f, +w, -w, w, 0.0f, 1.0f, +w, w, w, 0.0f, 0.0f, +w, w, -w, - 1.0f, 0.0f, +w, -w, -w, t+3); + 1.0f, 0.0f, +w, -w, -w, sky[3]); draw_envbox_aux(0.0f, 1.0f, -w, w, w, 0.0f, 0.0f, +w, w, w, 1.0f, 0.0f, +w, -w, w, - 1.0f, 1.0f, -w, -w, w, t+4); + 1.0f, 1.0f, -w, -w, w, sky[4]); draw_envbox_aux(0.0f, 1.0f, +w, w, -w, 0.0f, 0.0f, -w, w, -w, 1.0f, 0.0f, -w, -w, -w, - 1.0f, 1.0f, +w, -w, -w, t+5); + 1.0f, 1.0f, +w, -w, -w, sky[5]); glDepthMask(GL_TRUE); } diff --git a/source/src/world.cpp b/source/src/world.cpp index c4e8ee5e..6853f606 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -368,7 +368,7 @@ void empty_world(int factor, bool force) // main empty world creation routine }; calclight(); - startmap("maps/unnamed"); + startmap(""); if(oldworld) { delete[] oldworld;