diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 8f943972..1c879d73 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -56,6 +56,20 @@ void renderclip(entity &e) glEnable(GL_TEXTURE_2D); } +void rendermapmodels() +{ + loopv(ents) + { + entity &e = ents[i]; + if(e.type==MAPMODEL) + { + mapmodelinfo &mmi = getmminfo(e.attr2); + if(!&mmi) continue; + rendermodel(mmi.name, ANIM_MAPMODEL|ANIM_LOOP, e.attr4, 0, vec(e.x, e.y, (float)S(e.x, e.y)->floor+mmi.zoff+e.attr3), (float)((e.attr1+7)-(e.attr1+7)%15), 0, 10.0f); + } + } +} + void renderentities() { if(editmode && !reflecting && !refracting && !stenciling) @@ -78,13 +92,7 @@ void renderentities() loopv(ents) { entity &e = ents[i]; - if(e.type==MAPMODEL) - { - mapmodelinfo &mmi = getmminfo(e.attr2); - if(!&mmi) continue; - rendermodel(mmi.name, ANIM_MAPMODEL|ANIM_LOOP, e.attr4, 0, vec(e.x, e.y, (float)S(e.x, e.y)->floor+mmi.zoff+e.attr3), (float)((e.attr1+7)-(e.attr1+7)%15), 0, 10.0f); - } - else if(isitem(e.type)) + if(isitem(e.type)) { if((!OUTBORD(e.x, e.y) && e.spawned) || editmode) { diff --git a/source/src/protos.h b/source/src/protos.h index 1d95318c..70519a72 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -641,6 +641,7 @@ extern const char *entnames[]; extern void putitems(ucharbuf &p); extern void pickupeffects(int n, playerent *d); extern void renderentities(); +extern void rendermapmodels(); extern void resetspawns(); extern void setspawn(int i, bool on); extern void checkitems(playerent *d); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index b3109390..f1e99c0c 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -978,6 +978,12 @@ void gl_drawframe(int w, int h, float changelod, float curfps) xtraverts = 0; + startmodelbatches(); + rendermapmodels(); + endmodelbatches(); + + if(stencilshadow && hasstencil && stencilbits >= 8) drawstencilshadows(); + startmodelbatches(); renderentities(); endmodelbatches(); @@ -992,8 +998,6 @@ void gl_drawframe(int w, int h, float changelod, float curfps) renderbounceents(); endmodelbatches(); - if(stencilshadow && hasstencil && stencilbits >= 8) drawstencilshadows(); - // Added by Rick: Need todo here because of drawing the waypoints WaypointClass.Think(); // end add diff --git a/source/src/shadow.cpp b/source/src/shadow.cpp index eb22dba4..8d6d14a4 100644 --- a/source/src/shadow.cpp +++ b/source/src/shadow.cpp @@ -355,6 +355,7 @@ void drawstencilshadows() } startmodelbatches(); + rendermapmodels(); renderentities(); renderclients(); renderbounceents(); @@ -369,6 +370,7 @@ void drawstencilshadows() glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); startmodelbatches(); + rendermapmodels(); renderentities(); renderclients(); renderbounceents();