From a99b97689e5e0131ad4b45ede2eea0390a7e6221 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 4 Jul 2006 00:46:24 +0000 Subject: [PATCH] More polymost shading stuff git-svn-id: https://svn.eduke32.com/eduke32@206 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/Makefile | 2 +- polymer/build/src/polymost.c | 20 +- .../StartupWinController.game.m | 0 polymer/build/{game => testgame}/bstub.c | 0 polymer/build/{game => testgame}/game.c | 0 polymer/build/{game => testgame}/game.h | 0 .../build/{game => testgame}/jfaud_sound.cpp | 0 polymer/build/{game => testgame}/names.h | 0 .../build/{game => testgame}/startgtk.game.c | 0 .../build/{game => testgame}/startwin.game.c | 0 .../build/{game => testgame}/startwin.game.h | 0 polymer/eduke32/source/astub.c | 297 +++++++++--------- 12 files changed, 160 insertions(+), 159 deletions(-) rename polymer/build/{game => testgame}/StartupWinController.game.m (100%) rename polymer/build/{game => testgame}/bstub.c (100%) rename polymer/build/{game => testgame}/game.c (100%) rename polymer/build/{game => testgame}/game.h (100%) rename polymer/build/{game => testgame}/jfaud_sound.cpp (100%) rename polymer/build/{game => testgame}/names.h (100%) rename polymer/build/{game => testgame}/startgtk.game.c (100%) rename polymer/build/{game => testgame}/startwin.game.c (100%) rename polymer/build/{game => testgame}/startwin.game.h (100%) diff --git a/polymer/build/Makefile b/polymer/build/Makefile index 861d8a6bc..9c4c02de7 100644 --- a/polymer/build/Makefile +++ b/polymer/build/Makefile @@ -35,7 +35,7 @@ FMODROOTWIN=c:/sdks/fmodapi374win/api # build locations - OBJ gets overridden to the game-specific objects dir OBJ?=obj.gnu/ SRC=src/ -GAME=game/ +GAME=testgame/ RSRC=rsrc/ INC=include/ diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 0ab183890..e0c0cc94b 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -83,7 +83,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB]; #define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering) #define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow! #define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default -#define FOGSCALE 0.0000896 +#define FOGSCALE 0.0000820 #define PI 3.14159265358979323 static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; @@ -2208,7 +2208,7 @@ static void polymost_drawalls (long bunch) col[2] = (float)palookupfog[sec->floorpal].b / 63.f; col[3] = 0; bglFogfv(GL_FOG_COLOR,col); - bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->floorshade<0?klabs(sec->floorshade):1)-(sec->floorshade>0?2/sec->floorshade:0)); + bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); } @@ -2368,7 +2368,10 @@ static void polymost_drawalls (long bunch) } domostpolymethod = (globalorientation>>7)&3; if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling + bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->floorshade<0?klabs(sec->floorshade):1))-(sec->floorshade>0?3/sec->floorshade:0)+(sec->floorshade==1?2.5:0)+(sec->floorshade==-1?-1:0)); pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor + bglFogf(GL_FOG_DENSITY,foggymcfogfogger); domostpolymethod = 0; } else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1))) @@ -2721,7 +2724,10 @@ static void polymost_drawalls (long bunch) } domostpolymethod = (globalorientation>>7)&3; if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling + bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->ceilingshade<0?klabs(sec->ceilingshade):1))-(sec->ceilingshade>0?3/sec->ceilingshade:0)+(sec->ceilingshade==1?2.5:0)+(sec->ceilingshade==-1?-1:0)); pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil + bglFogf(GL_FOG_DENSITY,foggymcfogfogger); domostpolymethod = 0; } else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) @@ -3048,7 +3054,7 @@ static void polymost_drawalls (long bunch) { bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); - bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)-(wal->shade>0?2/wal->shade:0)); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0)); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } @@ -3089,7 +3095,7 @@ static void polymost_drawalls (long bunch) { bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); - bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(nwal->shade<0?klabs(nwal->shade):1)-(nwal->shade>0?2/nwal->shade:0)); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(nwal->shade<0?klabs(nwal->shade):1))-(nwal->shade>0?3/nwal->shade:0)+(nwal->shade==1?2.5:0)+(nwal->shade==-1?-1:0)); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } @@ -3126,7 +3132,7 @@ static void polymost_drawalls (long bunch) { bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); - bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)-(wal->shade>0?2/wal->shade:0)); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0)); pow2xsplit = 1; domost(x0,-10000,x1,-10000); bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } @@ -3580,7 +3586,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; col[2] = (float)palookupfog[sec->floorpal].b / 63.f; col[3] = 0; bglFogfv(GL_FOG_COLOR,col); - bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); + bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0)); } } #endif @@ -3687,7 +3693,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } col[2] = (float)palookupfog[sector[tspr->sectnum].floorpal].b / 63.f; col[3] = 0; bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 - bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))))/(globalshade<0?klabs(globalshade):1)-(globalshade>0?2/globalshade:0)); + bglFogf(GL_FOG_DENSITY,((gvisibility*0.65*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))))/(globalshade<0?klabs(globalshade):1))-(globalshade>0?3/globalshade:0)+(globalshade==1?2.5:0)+(globalshade==-1?-1:0)); } while (rendmode == 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) { diff --git a/polymer/build/game/StartupWinController.game.m b/polymer/build/testgame/StartupWinController.game.m similarity index 100% rename from polymer/build/game/StartupWinController.game.m rename to polymer/build/testgame/StartupWinController.game.m diff --git a/polymer/build/game/bstub.c b/polymer/build/testgame/bstub.c similarity index 100% rename from polymer/build/game/bstub.c rename to polymer/build/testgame/bstub.c diff --git a/polymer/build/game/game.c b/polymer/build/testgame/game.c similarity index 100% rename from polymer/build/game/game.c rename to polymer/build/testgame/game.c diff --git a/polymer/build/game/game.h b/polymer/build/testgame/game.h similarity index 100% rename from polymer/build/game/game.h rename to polymer/build/testgame/game.h diff --git a/polymer/build/game/jfaud_sound.cpp b/polymer/build/testgame/jfaud_sound.cpp similarity index 100% rename from polymer/build/game/jfaud_sound.cpp rename to polymer/build/testgame/jfaud_sound.cpp diff --git a/polymer/build/game/names.h b/polymer/build/testgame/names.h similarity index 100% rename from polymer/build/game/names.h rename to polymer/build/testgame/names.h diff --git a/polymer/build/game/startgtk.game.c b/polymer/build/testgame/startgtk.game.c similarity index 100% rename from polymer/build/game/startgtk.game.c rename to polymer/build/testgame/startgtk.game.c diff --git a/polymer/build/game/startwin.game.c b/polymer/build/testgame/startwin.game.c similarity index 100% rename from polymer/build/game/startwin.game.c rename to polymer/build/testgame/startwin.game.c diff --git a/polymer/build/game/startwin.game.h b/polymer/build/testgame/startwin.game.h similarity index 100% rename from polymer/build/game/startwin.game.h rename to polymer/build/testgame/startwin.game.h diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index e05f30e26..8442a2359 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1831,45 +1831,6 @@ void Keys3d(void) keystatus[KEYSC_L] = 0; } - if ((keystatus[KEYSC_G] > 0)) // G - { - switch (searchstat) - { - case 0: - strcpy(tempbuf,"Wall picnum: "); - i = getnumber256(tempbuf,wall[searchwall].picnum,MAXTILES-1,0); - if(tilesizx[i] != 0) - wall[searchwall].picnum = i; - break; - case 1: - strcpy(tempbuf,"Sector ceiling picnum: "); - i = getnumber256(tempbuf,sector[searchsector].ceilingpicnum,MAXTILES-1,0); - if(tilesizx[i] != 0) - sector[searchsector].ceilingpicnum = i; - break; - case 2: - strcpy(tempbuf,"Sector floor picnum: "); - i = getnumber256(tempbuf,sector[searchsector].floorpicnum,MAXTILES-1,0); - if(tilesizx[i] != 0) - sector[searchsector].floorpicnum = i; - break; - case 3: - strcpy(tempbuf,"Sprite picnum: "); - i = getnumber256(tempbuf,sprite[searchwall].picnum,MAXTILES-1,0); - if(tilesizx[i] != 0) - sprite[searchwall].picnum = i; - break; - case 4: - strcpy(tempbuf,"Masked wall picnum: "); - i = getnumber256(tempbuf,wall[searchwall].overpicnum,MAXTILES-1,0); - if(tilesizx[i] != 0) - wall[searchwall].overpicnum = i; - break; - } - asksave = 1; - keystatus[KEYSC_G] = 0; - } - getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0); if (keystatus[KEYSC_CAPS] > 0) @@ -1883,118 +1844,6 @@ void Keys3d(void) keystatus[KEYSC_CAPS] = 0; } - - - if (keystatus[KEYSC_B] > 0) // B (clip Blocking xor) (3D) - { - if (searchstat == 3) - { - sprite[searchwall].cstat ^= 1; - // sprite[searchwall].cstat &= ~256; - // sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); - sprintf(getmessage,"Sprite (%d) blocking %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF"); - message(getmessage); - asksave = 1; - } - else - { - wall[searchwall].cstat ^= 1; - // wall[searchwall].cstat &= ~64; - if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) - { - wall[wall[searchwall].nextwall].cstat &= ~(1+64); - wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); - } - sprintf(getmessage,"Wall (%d) blocking %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF"); - message(getmessage); - asksave = 1; - } - keystatus[KEYSC_B] = 0; - } - if (keystatus[KEYSC_T] > 0) // T (transluscence for sprites/masked walls) - { - if (searchstat == 1) //Set masked/transluscent ceilings/floors - { - i = (sector[searchsector].ceilingstat&(128+256)); - sector[searchsector].ceilingstat &= ~(128+256); - switch(i) - { - case 0: sector[searchsector].ceilingstat |= 128; break; - case 128: sector[searchsector].ceilingstat |= 256; break; - case 256: sector[searchsector].ceilingstat |= 384; break; - case 384: sector[searchsector].ceilingstat |= 0; break; - } - asksave = 1; - } - if (searchstat == 2) - { - i = (sector[searchsector].floorstat&(128+256)); - sector[searchsector].floorstat &= ~(128+256); - switch(i) - { - case 0: sector[searchsector].floorstat |= 128; break; - case 128: sector[searchsector].floorstat |= 256; break; - case 256: sector[searchsector].floorstat |= 384; break; - case 384: sector[searchsector].floorstat |= 0; break; - } - asksave = 1; - } - - if ((keystatus[KEYSC_QUOTE]) > 0) - { - switch (searchstat) - { - case 0: case 4: - strcpy(buffer,"Wall lotag: "); - wall[searchwall].lotag = getnumber256(buffer,(long)wall[searchwall].lotag,65536L,0); - break; - case 1: - strcpy(buffer,"Sector lotag: "); - sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0); - break; - case 2: - strcpy(buffer,"Sector lotag: "); - sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0); - break; - case 3: - strcpy(buffer,"Sprite lotag: "); - sprite[searchwall].lotag = getnumber256(buffer,(long)sprite[searchwall].lotag,65536L,0); - break; - } - } - else - { - if (searchstat == 3) - { - if ((sprite[searchwall].cstat&2) == 0) - sprite[searchwall].cstat |= 2; - else if ((sprite[searchwall].cstat&512) == 0) - sprite[searchwall].cstat |= 512; - else - sprite[searchwall].cstat &= ~(2+512); - asksave = 1; - } - if (searchstat == 4) - { - if ((wall[searchwall].cstat&128) == 0) - wall[searchwall].cstat |= 128; - else if ((wall[searchwall].cstat&512) == 0) - wall[searchwall].cstat |= 512; - else - wall[searchwall].cstat &= ~(128+512); - - if (wall[searchwall].nextwall >= 0) - { - wall[wall[searchwall].nextwall].cstat &= ~(128+512); - wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512)); - } - asksave = 1; - } - } - keystatus[KEYSC_T] = 0; - } - - if (keystatus[KEYSC_M] > 0 && (keystatus[KEYSC_QUOTE]) > 0) // M { switch (searchstat) @@ -3269,8 +3118,154 @@ void Keys3d(void) keystatus[0x3b]=0; } + if ((keystatus[KEYSC_G] > 0)) // G + { + switch (searchstat) + { + case 0: + strcpy(tempbuf,"Wall picnum: "); + i = getnumber256(tempbuf,wall[searchwall].picnum,MAXTILES-1,0); + if(tilesizx[i] != 0) + wall[searchwall].picnum = i; + break; + case 1: + strcpy(tempbuf,"Sector ceiling picnum: "); + i = getnumber256(tempbuf,sector[searchsector].ceilingpicnum,MAXTILES-1,0); + if(tilesizx[i] != 0) + sector[searchsector].ceilingpicnum = i; + break; + case 2: + strcpy(tempbuf,"Sector floor picnum: "); + i = getnumber256(tempbuf,sector[searchsector].floorpicnum,MAXTILES-1,0); + if(tilesizx[i] != 0) + sector[searchsector].floorpicnum = i; + break; + case 3: + strcpy(tempbuf,"Sprite picnum: "); + i = getnumber256(tempbuf,sprite[searchwall].picnum,MAXTILES-1,0); + if(tilesizx[i] != 0) + sprite[searchwall].picnum = i; + break; + case 4: + strcpy(tempbuf,"Masked wall picnum: "); + i = getnumber256(tempbuf,wall[searchwall].overpicnum,MAXTILES-1,0); + if(tilesizx[i] != 0) + wall[searchwall].overpicnum = i; + break; + } + asksave = 1; + keystatus[KEYSC_G] = 0; + } + if (keystatus[KEYSC_B] > 0) // B (clip Blocking xor) (3D) + { + if (searchstat == 3) + { + sprite[searchwall].cstat ^= 1; + // sprite[searchwall].cstat &= ~256; + // sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); + sprintf(getmessage,"Sprite (%d) blocking %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF"); + message(getmessage); + asksave = 1; + } + else + { + wall[searchwall].cstat ^= 1; + // wall[searchwall].cstat &= ~64; + if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) + { + wall[wall[searchwall].nextwall].cstat &= ~(1+64); + wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); + } + sprintf(getmessage,"Wall (%d) blocking %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF"); + message(getmessage); + asksave = 1; + } + keystatus[KEYSC_B] = 0; + } + if (keystatus[KEYSC_T] > 0) // T (transluscence for sprites/masked walls) + { + if (searchstat == 1) //Set masked/transluscent ceilings/floors + { + i = (sector[searchsector].ceilingstat&(128+256)); + sector[searchsector].ceilingstat &= ~(128+256); + switch(i) + { + case 0: sector[searchsector].ceilingstat |= 128; break; + case 128: sector[searchsector].ceilingstat |= 256; break; + case 256: sector[searchsector].ceilingstat |= 384; break; + case 384: sector[searchsector].ceilingstat |= 0; break; + } + asksave = 1; + } + if (searchstat == 2) + { + i = (sector[searchsector].floorstat&(128+256)); + sector[searchsector].floorstat &= ~(128+256); + switch(i) + { + case 0: sector[searchsector].floorstat |= 128; break; + case 128: sector[searchsector].floorstat |= 256; break; + case 256: sector[searchsector].floorstat |= 384; break; + case 384: sector[searchsector].floorstat |= 0; break; + } + asksave = 1; + } + + if ((keystatus[KEYSC_QUOTE]) > 0) + { + switch (searchstat) + { + case 0: case 4: + strcpy(buffer,"Wall lotag: "); + wall[searchwall].lotag = getnumber256(buffer,(long)wall[searchwall].lotag,65536L,0); + break; + case 1: + strcpy(buffer,"Sector lotag: "); + sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0); + break; + case 2: + strcpy(buffer,"Sector lotag: "); + sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0); + break; + case 3: + strcpy(buffer,"Sprite lotag: "); + sprite[searchwall].lotag = getnumber256(buffer,(long)sprite[searchwall].lotag,65536L,0); + break; + } + } + else + { + if (searchstat == 3) + { + if ((sprite[searchwall].cstat&2) == 0) + sprite[searchwall].cstat |= 2; + else if ((sprite[searchwall].cstat&512) == 0) + sprite[searchwall].cstat |= 512; + else + sprite[searchwall].cstat &= ~(2+512); + asksave = 1; + } + if (searchstat == 4) + { + if ((wall[searchwall].cstat&128) == 0) + wall[searchwall].cstat |= 128; + else if ((wall[searchwall].cstat&512) == 0) + wall[searchwall].cstat |= 512; + else + wall[searchwall].cstat &= ~(128+512); + + if (wall[searchwall].nextwall >= 0) + { + wall[wall[searchwall].nextwall].cstat &= ~(128+512); + wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512)); + } + asksave = 1; + } + } + keystatus[KEYSC_T] = 0; + } if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x1c]==1) // ' ENTER {