d_deh.c: ------------------------------------------------------------------------------- 113: // haleyjd 9/22/99 int HelperThing = -1; // in P_SpawnMapThing to substitute helper thing 989: static void deh_procHelperThing(DEHFILE *, FILE *, char *); // haleyjd 9/22/99 // haleyjd: handlers to fully deprecate the DeHackEd text section static void deh_procBexSounds(DEHFILE *, FILE *, char *); static void deh_procBexMusic(DEHFILE *, FILE *, char *); static void deh_procBexSprites(DEHFILE *, FILE *, char *); 1029: /* 13 */ {"[HELPER]", deh_procHelperThing}, // helper thing substitution haleyjd 9/22/99 /* 14 */ {"[SPRITES]", deh_procBexSprites}, // bex style sprites /* 15 */ {"[SOUNDS]", deh_procBexSounds}, // bex style sounds /* 16 */ {"[MUSIC]", deh_procBexMusic}, // bex style music 1358: // haleyjd: support for BEX SPRITES, SOUNDS, and MUSIC char *deh_spritenames[NUMSPRITES + 1]; char *deh_musicnames[NUMMUSIC + 1]; char *deh_soundnames[NUMSFX + 1]; void D_BuildBEXTables(void) { int i; // moved from ProcessDehFile, then we don't need the static int i for (i = 0; i < NUMSTATES; i++) // remember what they start as for deh xref deh_codeptr[i] = states[i].action; for(i = 0; i < NUMSPRITES; i++) deh_spritenames[i] = strdup(sprnames[i]); deh_spritenames[NUMSPRITES] = NULL; for(i = 1; i < NUMMUSIC; i++) deh_musicnames[i] = strdup(S_music[i].name); deh_musicnames[0] = deh_musicnames[NUMMUSIC] = NULL; for(i = 1; i < NUMSFX; i++) deh_soundnames[i] = strdup(S_sfx[i].name); deh_soundnames[0] = deh_soundnames[NUMSFX] = NULL; } 2740: //======================================================================== // haleyjd 9/22/99 // // deh_procHelperThing // // Allows handy substitution of any thing for helper dogs. DEH patches // are being made frequently for this purpose and it requires a complete // rewiring of the DOG thing. I feel this is a waste of effort, and so // have added this new [HELPER] BEX block static void deh_procHelperThing(DEHFILE *fpin, FILE *fpout, char *line) { char key[DEH_MAXKEYLEN]; char inbuffer[DEH_BUFFERMAX]; uint_64_t value; // All deh values are ints or longs strncpy(inbuffer,line,DEH_BUFFERMAX); while (!dehfeof(fpin) && *inbuffer && (*inbuffer != ' ')) { if (!dehfgets(inbuffer, sizeof(inbuffer), fpin)) break; lfstrip(inbuffer); if (!*inbuffer) break; if (!deh_GetData(inbuffer,key,&value,NULL,fpout)) // returns TRUE if ok { if (fpout) fprintf(fpout,"Bad data pair in '%s'\n",inbuffer); continue; } // Otherwise it's ok if (fpout) { fprintf(fpout,"Processing Helper Thing item '%s'\n", key); fprintf(fpout,"value is %i", (int)value); } if (!strncasecmp(key, "type", 4)) HelperThing = (int)value; } return; } // // deh_procBexSprites // // Supports sprite name substitutions without requiring use // of the DeHackEd Text block // static void deh_procBexSprites(DEHFILE *fpin, FILE *fpout, char *line) { char key[DEH_MAXKEYLEN]; char inbuffer[DEH_BUFFERMAX]; uint_64_t value; // All deh values are ints or longs char *strval; // holds the string value of the line char candidate[5]; int rover; if(fpout) fprintf(fpout,"Processing sprite name substitution\n"); strncpy(inbuffer,line,DEH_BUFFERMAX); while(!dehfeof(fpin) && *inbuffer && (*inbuffer != ' ')) { if(!dehfgets(inbuffer, sizeof(inbuffer), fpin)) break; if(*inbuffer == '#') continue; // skip comment lines lfstrip(inbuffer); if(!*inbuffer) break; // killough 11/98 if(!deh_GetData(inbuffer,key,&value,&strval,fpout)) // returns TRUE if ok { if(fpout) fprintf(fpout,"Bad data pair in '%s'\n",inbuffer); continue; } // do it memset(candidate, 0, sizeof(candidate)); strncpy(candidate, ptr_lstrip(strval), 4); if(strlen(candidate) != 4) { if(fpout) fprintf(fpout, "Bad length for sprite name '%s'\n", candidate); continue; } rover = 0; while(deh_spritenames[rover]) { if(!strncasecmp(deh_spritenames[rover], key, 4)) { if(fpout) fprintf(fpout, "Substituting '%s' for sprite '%s'\n", candidate, deh_spritenames[rover]); sprnames[rover] = strdup(candidate); break; } rover++; } } } // ditto for sound names static void deh_procBexSounds(DEHFILE *fpin, FILE *fpout, char *line) { char key[DEH_MAXKEYLEN]; char inbuffer[DEH_BUFFERMAX]; uint_64_t value; // All deh values are ints or longs char *strval; // holds the string value of the line char candidate[7]; int rover, len; if(fpout) fprintf(fpout,"Processing sound name substitution\n"); strncpy(inbuffer,line,DEH_BUFFERMAX); while(!dehfeof(fpin) && *inbuffer && (*inbuffer != ' ')) { if(!dehfgets(inbuffer, sizeof(inbuffer), fpin)) break; if(*inbuffer == '#') continue; // skip comment lines lfstrip(inbuffer); if(!*inbuffer) break; // killough 11/98 if(!deh_GetData(inbuffer,key,&value,&strval,fpout)) // returns TRUE if ok { if(fpout) fprintf(fpout,"Bad data pair in '%s'\n",inbuffer); continue; } // do it memset(candidate, 0, 7); strncpy(candidate, ptr_lstrip(strval), 6); len = strlen(candidate); if(len < 1 || len > 6) { if(fpout) fprintf(fpout, "Bad length for sound name '%s'\n", candidate); continue; } rover = 1; while(deh_soundnames[rover]) { if(!strncasecmp(deh_soundnames[rover], key, 6)) { if(fpout) fprintf(fpout, "Substituting '%s' for sound '%s'\n", candidate, deh_soundnames[rover]); S_sfx[rover].name = strdup(candidate); break; } rover++; } } } // ditto for music names static void deh_procBexMusic(DEHFILE *fpin, FILE *fpout, char *line) { char key[DEH_MAXKEYLEN]; char inbuffer[DEH_BUFFERMAX]; uint_64_t value; // All deh values are ints or longs char *strval; // holds the string value of the line char candidate[7]; int rover, len; if(fpout) fprintf(fpout,"Processing music name substitution\n"); strncpy(inbuffer,line,DEH_BUFFERMAX); while(!dehfeof(fpin) && *inbuffer && (*inbuffer != ' ')) { if(!dehfgets(inbuffer, sizeof(inbuffer), fpin)) break; if(*inbuffer == '#') continue; // skip comment lines lfstrip(inbuffer); if(!*inbuffer) break; // killough 11/98 if(!deh_GetData(inbuffer,key,&value,&strval,fpout)) // returns TRUE if ok { if(fpout) fprintf(fpout,"Bad data pair in '%s'\n",inbuffer); continue; } // do it memset(candidate, 0, 7); strncpy(candidate, ptr_lstrip(strval), 6); len = strlen(candidate); if(len < 1 || len > 6) { if(fpout) fprintf(fpout, "Bad length for music name '%s'\n", candidate); continue; } rover = 1; while(deh_musicnames[rover]) { if(!strncasecmp(deh_musicnames[rover], key, 6)) { if(fpout) fprintf(fpout, "Substituting '%s' for music '%s'\n", candidate, deh_musicnames[rover]); S_music[rover].name = strdup(candidate); break; } rover++; } } } d_main.c: ------------------------------------------------------------------------------- 1183: D_BuildBEXTables(); // haleyjd m_fixed.h: ------------------------------------------------------------------------------- 103: # else /* _MSC_VER */ /* killough 5/10/98: In djgpp, use inlined assembly for performance * CPhipps - made __inline__ to inline, as specified in the gcc docs * Also made const. Also __asm__ to asm, as in docs. * Replaced inline asm with Julian's version for Eternity dated 6/7/2001 */ inline static CONSTFUNC fixed_t FixedMul(fixed_t a, fixed_t b) { fixed_t result; asm ( " imull %2 ;" " shrdl $16,%%edx,%0 ;" : "=a" (result) /* eax is always the result */ : "0" (a), /* eax is also first operand */ "rm" (b) /* second operand can be reg or mem */ : "%edx", "%cc" /* edx and condition codes clobbered */ ); return result; } # endif /* _MSC_VER */ 169: # else /* _MSC_VER */ /* killough 5/10/98: In djgpp, use inlined assembly for performance * killough 9/5/98: optimized to reduce the number of branches * CPhipps - made __inline__ to inline, as specified in the gcc docs * Also made const, also __asm__ to asm as in docs. * Replaced inline asm with Julian's version for Eternity dated 6/7/2001 */ inline static CONSTFUNC fixed_t FixedDiv(fixed_t a, fixed_t b) { //e6y: zg is a master of engineer science if ((unsigned)D_abs(a) >> 14 < (unsigned)D_abs(b)) { fixed_t result; asm ( " idivl %3 ;" : "=a" (result) : "0" (a<<16), "d" (a>>16), "rm" (b) : "%cc" ); return result; } return ((a^b)>>31) ^ INT_MAX; } # endif /* _MSC_VER */ p_enemy.c: ------------------------------------------------------------------------------- 448: // haleyjd: allow all friends of HelperType to also jump down if ((actor->type == MT_DOGS || (actor->type == (HelperThing-1) && actor->flags&MF_FRIEND)) p_mobj.c: ------------------------------------------------------------------------------- 650: /* haleyjd: stupid nightmare respawning bug fix * * 08/09/00: compatibility added, time to ramble :) * This fixes the notorious nightmare respawning bug that causes monsters * that didn't spawn at level startup to respawn at the point (0,0) * regardless of that point's nature. SMMU and Eternity need this for * script-spawned things like Halif Swordsmythe, as well. * * cph - copied from eternity, except comp_respawnfix becomes comp_respawn * and the logic is reversed (i.e. like the rest of comp_ it *disables* * the fix) */ if(!comp[comp_respawn] && !x && !y) { // spawnpoint was zeroed out, so use point of death instead x = mobj->x; y = mobj->y; } 1230: if(HelperThing != -1) // haleyjd 9/22/99: deh substitution { int type = HelperThing - 1; if(type >= 0 && type < NUMMOBJTYPES) { i = type; } else { doom_printf("Invalid value %i for helper, ignored.", HelperThing); i = MT_DOGS; } } else { i = MT_DOGS; } r_draw.c: ------------------------------------------------------------------------------- 77: // SoM: OPTIMIZE for ANYRES typedef enum { COL_NONE, COL_OPAQUE, COL_TRANS, COL_FLEXTRANS, COL_FUZZ, COL_FLEXADD } columntype_e; 97: // SoM 7-28-04: Fix the fuzz problem. static const byte *tempfuzzmap; 171: // // Error functions that will abort if R_FlushColumns tries to flush // columns without a column type. // static void R_FlushWholeError(void) { I_Error("R_FlushWholeColumns called without being initialized.\n"); } static void R_FlushHTError(void) { I_Error("R_FlushHTColumns called without being initialized.\n"); } static void R_QuadFlushError(void) { I_Error("R_FlushQuadColumn called without being initialized.\n"); } static void (*R_FlushWholeColumns)(void) = R_FlushWholeError; static void (*R_FlushHTColumns)(void) = R_FlushHTError; static void (*R_FlushQuadColumn)(void) = R_QuadFlushError; static void R_FlushColumns(void) { if(temp_x != 4 || commontop >= commonbot) R_FlushWholeColumns(); else { R_FlushHTColumns(); R_FlushQuadColumn(); } temp_x = 0; } // // R_ResetColumnBuffer // // haleyjd 09/13/04: new function to call from main rendering loop // which gets rid of the unnecessary reset of various variables during // column drawing. // void R_ResetColumnBuffer(void) { // haleyjd 10/06/05: this must not be done if temp_x == 0! if(temp_x) R_FlushColumns(); temptype = COL_NONE; R_FlushWholeColumns = R_FlushWholeError; R_FlushHTColumns = R_FlushHTError; R_FlushQuadColumn = R_QuadFlushError; } r_draw.h: ------------------------------------------------------------------------------- 158: // haleyjd 09/13/04: new function to call from main rendering loop // which gets rid of the unnecessary reset of various variables during // column drawing. void R_ResetColumnBuffer(void); r_drawcolumn.inl: ------------------------------------------------------------------------------- 212: // SoM: MAGIC { // haleyjd: reordered predicates if(temp_x == 4 || (temp_x && (temptype != COLTYPE || temp_x + startx != dcvars->x))) R_FlushColumns(); if(!temp_x) { startx = dcvars->x; tempyl[0] = commontop = dcvars->yl; tempyh[0] = commonbot = dcvars->yh; temptype = COLTYPE; #if (R_DRAWCOLUMN_PIPELINE & RDC_TRANSLUCENT) temptranmap = tranmap; #elif (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) tempfuzzmap = fullcolormap; // SoM 7-28-04: Fix the fuzz problem. #endif R_FlushWholeColumns = R_FLUSHWHOLE_FUNCNAME; R_FlushHTColumns = R_FLUSHHEADTAIL_FUNCNAME; R_FlushQuadColumn = R_FLUSHQUAD_FUNCNAME; dest = &TEMPBUF[dcvars->yl << 2]; } else { tempyl[temp_x] = dcvars->yl; tempyh[temp_x] = dcvars->yh; if(dcvars->yl > commontop) commontop = dcvars->yl; if(dcvars->yh < commonbot) commonbot = dcvars->yh; dest = &TEMPBUF[(dcvars->yl << 2) + temp_x]; } temp_x += 1; } r_drawflush.inl: ------------------------------------------------------------------------------- 92: // // R_FlushWholeOpaque // // Flushes the entire columns in the buffer, one at a time. // This is used when a quad flush isn't possible. // Opaque version -- no remapping whatsoever. // static void R_FLUSHWHOLE_FUNCNAME(void) { SCREENTYPE *source; SCREENTYPE *dest; int count, yl; while(--temp_x >= 0) { yl = tempyl[temp_x]; source = &TEMPBUF[temp_x + (yl << 2)]; dest = drawvars.TOPLEFT + yl*drawvars.PITCH + startx + temp_x; count = tempyh[temp_x] - yl + 1; while(--count >= 0) { #if (R_DRAWCOLUMN_PIPELINE & RDC_TRANSLUCENT) *dest = GETDESTCOLOR(*dest, *source); #elif (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) // SoM 7-28-04: Fix the fuzz problem. *dest = GETDESTCOLOR(dest[fuzzoffset[fuzzpos]]); // Clamp table lookup index. if(++fuzzpos == FUZZTABLE) fuzzpos = 0; #else *dest = *source; #endif source += 4; dest += drawvars.PITCH; } } } // // R_FlushHTOpaque // // Flushes the head and tail of columns in the buffer in // preparation for a quad flush. // Opaque version -- no remapping whatsoever. // static void R_FLUSHHEADTAIL_FUNCNAME(void) { SCREENTYPE *source; SCREENTYPE *dest; int count, colnum = 0; int yl, yh; while(colnum < 4) { yl = tempyl[colnum]; yh = tempyh[colnum]; // flush column head if(yl < commontop) { source = &TEMPBUF[colnum + (yl << 2)]; dest = drawvars.TOPLEFT + yl*drawvars.PITCH + startx + colnum; count = commontop - yl; while(--count >= 0) { #if (R_DRAWCOLUMN_PIPELINE & RDC_TRANSLUCENT) // haleyjd 09/11/04: use temptranmap here *dest = GETDESTCOLOR(*dest, *source); #elif (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) // SoM 7-28-04: Fix the fuzz problem. *dest = GETDESTCOLOR(dest[fuzzoffset[fuzzpos]]); // Clamp table lookup index. if(++fuzzpos == FUZZTABLE) fuzzpos = 0; #else *dest = *source; #endif source += 4; dest += drawvars.PITCH; } } // flush column tail if(yh > commonbot) { source = &TEMPBUF[colnum + ((commonbot + 1) << 2)]; dest = drawvars.TOPLEFT + (commonbot + 1)*drawvars.PITCH + startx + colnum; count = yh - commonbot; while(--count >= 0) { #if (R_DRAWCOLUMN_PIPELINE & RDC_TRANSLUCENT) // haleyjd 09/11/04: use temptranmap here *dest = GETDESTCOLOR(*dest, *source); #elif (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) // SoM 7-28-04: Fix the fuzz problem. *dest = GETDESTCOLOR(dest[fuzzoffset[fuzzpos]]); // Clamp table lookup index. if(++fuzzpos == FUZZTABLE) fuzzpos = 0; #else *dest = *source; #endif source += 4; dest += drawvars.PITCH; } } ++colnum; } } static void R_FLUSHQUAD_FUNCNAME(void) { SCREENTYPE *source = &TEMPBUF[commontop << 2]; SCREENTYPE *dest = drawvars.TOPLEFT + commontop*drawvars.PITCH + startx; int count; #if (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) int fuzz1, fuzz2, fuzz3, fuzz4; fuzz1 = fuzzpos; fuzz2 = (fuzz1 + tempyl[1]) % FUZZTABLE; fuzz3 = (fuzz2 + tempyl[2]) % FUZZTABLE; fuzz4 = (fuzz3 + tempyl[3]) % FUZZTABLE; #endif count = commonbot - commontop + 1; #if (R_DRAWCOLUMN_PIPELINE & RDC_TRANSLUCENT) while(--count >= 0) { dest[0] = GETDESTCOLOR(dest[0], source[0]); dest[1] = GETDESTCOLOR(dest[1], source[1]); dest[2] = GETDESTCOLOR(dest[2], source[2]); dest[3] = GETDESTCOLOR(dest[3], source[3]); source += 4 * sizeof(byte); dest += drawvars.PITCH * sizeof(byte); } #elif (R_DRAWCOLUMN_PIPELINE & RDC_FUZZ) while(--count >= 0) { dest[0] = GETDESTCOLOR(dest[0 + fuzzoffset[fuzz1]]); dest[1] = GETDESTCOLOR(dest[1 + fuzzoffset[fuzz2]]); dest[2] = GETDESTCOLOR(dest[2 + fuzzoffset[fuzz3]]); dest[3] = GETDESTCOLOR(dest[3 + fuzzoffset[fuzz4]]); fuzz1 = (fuzz1 + 1) % FUZZTABLE; fuzz2 = (fuzz2 + 1) % FUZZTABLE; fuzz3 = (fuzz3 + 1) % FUZZTABLE; fuzz4 = (fuzz4 + 1) % FUZZTABLE; source += 4 * sizeof(byte); dest += drawvars.PITCH * sizeof(byte); } #else #if (R_DRAWCOLUMN_PIPELINE_BITS == 8) if ((sizeof(int) == 4) && (((int)source % 4) == 0) && (((int)dest % 4) == 0)) { while(--count >= 0) { *(int *)dest = *(int *)source; source += 4 * sizeof(byte); dest += drawvars.PITCH * sizeof(byte); } } else { while(--count >= 0) { dest[0] = source[0]; dest[1] = source[1]; dest[2] = source[2]; dest[3] = source[3]; source += 4 * sizeof(byte); dest += drawvars.PITCH * sizeof(byte); } } #else while(--count >= 0) { dest[0] = source[0]; dest[1] = source[1]; dest[2] = source[2]; dest[3] = source[3]; source += 4; dest += drawvars.PITCH; } #endif #endif } r_segs.c: ------------------------------------------------------------------------------- 301: // SoM: this should be set here ceilingclip[rw_x] = bottom; 321: // SoM: This should be set here to prevent overdraw floorclip[rw_x] = top; st_stuff.c: ------------------------------------------------------------------------------- 510: // haleyjd 10/12/03: classic DOOM problem of missing OUCH face // was due to inversion of this test: // if(plyr->health - st_oldhealth > ST_MUCHPAIN) if(st_oldhealth - plyr->health > ST_MUCHPAIN) { st_facecount = ST_TURNCOUNT; st_faceindex = ST_calcPainOffset() + ST_OUCHOFFSET; } 566: // haleyjd 10/12/03: classic DOOM problem of missing OUCH face // was due to inversion of this test: // if(plyr->health - st_oldhealth > ST_MUCHPAIN) if(st_oldhealth - plyr->health > ST_MUCHPAIN) { priority = 7; st_facecount = ST_TURNCOUNT; st_faceindex = ST_calcPainOffset() + ST_OUCHOFFSET; } w_wad.h: ------------------------------------------------------------------------------- 111: } li_namespace; // haleyjd 05/21/02: renamed from "namespace"