JIMITA DO THE SOC
This commit is contained in:
parent
b74cfca3e2
commit
73e4e67595
127
src/dehacked.c
127
src/dehacked.c
|
@ -738,11 +738,12 @@ static void readlight(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
}
|
}
|
||||||
|
#endif // HWRENDER
|
||||||
|
|
||||||
static void readspritelight(MYFILE *f, INT32 num)
|
static void readspriteframe(MYFILE *f, INT32 num, INT32 frame)
|
||||||
{
|
{
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||||
char *word;
|
char *word, *word2;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
INT32 value;
|
INT32 value;
|
||||||
|
|
||||||
|
@ -753,20 +754,122 @@ static void readspritelight(MYFILE *f, INT32 num)
|
||||||
if (s[0] == '\n')
|
if (s[0] == '\n')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// First remove trailing newline, if there is one
|
||||||
|
tmp = strchr(s, '\n');
|
||||||
|
if (tmp)
|
||||||
|
*tmp = '\0';
|
||||||
|
|
||||||
tmp = strchr(s, '#');
|
tmp = strchr(s, '#');
|
||||||
if (tmp)
|
if (tmp)
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
if (s == tmp)
|
if (s == tmp)
|
||||||
continue; // Skip comment lines, but don't break.
|
continue; // Skip comment lines, but don't break.
|
||||||
|
|
||||||
value = searchvalue(s);
|
// Set / reset word
|
||||||
|
word = s;
|
||||||
|
|
||||||
word = strtok(s, " ");
|
// Get the part before the " = "
|
||||||
if (word)
|
tmp = strchr(s, '=');
|
||||||
strupr(word);
|
if (tmp)
|
||||||
|
{
|
||||||
|
*(tmp-1) = '\0';
|
||||||
|
// Now get the part after
|
||||||
|
word2 = tmp += 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Get the part before the " "
|
||||||
|
tmp = strchr(s, ' ');
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
*tmp = '\0';
|
||||||
|
// Now get the part after
|
||||||
|
tmp++;
|
||||||
|
word2 = tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strupr(word);
|
||||||
|
value = atoi(word2); // used for numerical settings
|
||||||
|
|
||||||
|
if (frame >= 64)
|
||||||
|
{
|
||||||
|
deh_warning("Sprite %d: invalid frame %d", num, frame);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ROTSPRITE
|
||||||
|
if (fastcmp(word, "XPIVOT"))
|
||||||
|
spriteinfo[num].pivot[frame].x = value;
|
||||||
|
else if (fastcmp(word, "YPIVOT"))
|
||||||
|
spriteinfo[num].pivot[frame].y = value;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (fastcmp(word, "END"))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
deh_warning("Sprite %d frame %d: unknown word '%s'", num, frame, word);
|
||||||
|
}
|
||||||
|
} while (!myfeof(f)); // finish when the line is empty
|
||||||
|
|
||||||
|
Z_Free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void readspriteinfo(MYFILE *f, INT32 num)
|
||||||
|
{
|
||||||
|
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||||
|
char *word, *word2;
|
||||||
|
char *tmp;
|
||||||
|
INT32 value;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (myfgets(s, MAXLINELEN, f))
|
||||||
|
{
|
||||||
|
if (s[0] == '\n')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// First remove trailing newline, if there is one
|
||||||
|
tmp = strchr(s, '\n');
|
||||||
|
if (tmp)
|
||||||
|
*tmp = '\0';
|
||||||
|
|
||||||
|
tmp = strchr(s, '#');
|
||||||
|
if (tmp)
|
||||||
|
*tmp = '\0';
|
||||||
|
if (s == tmp)
|
||||||
|
continue; // Skip comment lines, but don't break.
|
||||||
|
|
||||||
|
// Set / reset word
|
||||||
|
word = s;
|
||||||
|
|
||||||
|
// Get the part before the " = "
|
||||||
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
*(tmp-1) = '\0';
|
||||||
|
// Now get the part after
|
||||||
|
word2 = tmp += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the part before the " "
|
||||||
|
tmp = strchr(s, ' ');
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
*tmp = '\0';
|
||||||
|
// Now get the part after
|
||||||
|
tmp++;
|
||||||
|
word2 = tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strupr(word);
|
||||||
|
value = atoi(word2); // used for numerical settings
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
if (fastcmp(word, "LIGHTTYPE"))
|
if (fastcmp(word, "LIGHTTYPE"))
|
||||||
{
|
{
|
||||||
INT32 oldvar;
|
INT32 oldvar;
|
||||||
|
@ -775,13 +878,19 @@ static void readspritelight(MYFILE *f, INT32 num)
|
||||||
t_lspr[num] = &lspr[value];
|
t_lspr[num] = &lspr[value];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
if (fastcmp(word, "FRAME"))
|
||||||
|
{
|
||||||
|
readspriteframe(f, num, R_Char2Frame(word2[0]));
|
||||||
|
spriteinfo[num].available = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
deh_warning("Sprite %d: unknown word '%s'", num, word);
|
deh_warning("Sprite %d: unknown word '%s'", num, word);
|
||||||
}
|
}
|
||||||
} while (!myfeof(f)); // finish when the line is empty
|
} while (!myfeof(f)); // finish when the line is empty
|
||||||
|
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
}
|
}
|
||||||
#endif // HWRENDER
|
|
||||||
|
|
||||||
static void readsprite2(MYFILE *f, INT32 num)
|
static void readsprite2(MYFILE *f, INT32 num)
|
||||||
{
|
{
|
||||||
|
@ -3898,19 +4007,19 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||||
ignorelines(f);
|
ignorelines(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if (fastcmp(word, "SPRITE"))
|
else if (fastcmp(word, "SPRITE"))
|
||||||
{
|
{
|
||||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||||
i = get_sprite(word2); // find a sprite by name
|
i = get_sprite(word2); // find a sprite by name
|
||||||
if (i < NUMSPRITES && i > 0)
|
if (i < NUMSPRITES && i > 0)
|
||||||
readspritelight(f, i);
|
readspriteinfo(f, i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
|
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
|
||||||
ignorelines(f);
|
ignorelines(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (fastcmp(word, "LEVEL"))
|
else if (fastcmp(word, "LEVEL"))
|
||||||
{
|
{
|
||||||
// Support using the actual map name,
|
// Support using the actual map name,
|
||||||
|
|
|
@ -5658,7 +5658,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
if (rollangle > 0)
|
if (rollangle > 0)
|
||||||
{
|
{
|
||||||
if (!sprframe->rotsprite.cached[rot])
|
if (!sprframe->rotsprite.cached[rot])
|
||||||
R_CacheRotSprite(sprframe, rot, flip);
|
R_CacheRotSprite(thing->sprite, thing->frame, sprframe, rot, flip);
|
||||||
rollangle /= ROTANGDIFF;
|
rollangle /= ROTANGDIFF;
|
||||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||||
if (rotsprite != NULL)
|
if (rotsprite != NULL)
|
||||||
|
|
13
src/r_defs.h
13
src/r_defs.h
|
@ -737,8 +737,21 @@ typedef struct
|
||||||
aatree_t *hardware_patch[8];
|
aatree_t *hardware_patch[8];
|
||||||
#endif
|
#endif
|
||||||
} rotsprite_t;
|
} rotsprite_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
INT32 x, y;
|
||||||
|
} spriteframepivot_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
#ifdef ROTSPRITE
|
||||||
|
spriteframepivot_t pivot[64];
|
||||||
|
#endif
|
||||||
|
boolean available;
|
||||||
|
} spriteinfo_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SRF_SINGLE = 0, // 0-angle for all rotations
|
SRF_SINGLE = 0, // 0-angle for all rotations
|
||||||
|
|
|
@ -72,6 +72,8 @@ static lighttable_t **spritelights;
|
||||||
INT16 negonearray[MAXVIDWIDTH];
|
INT16 negonearray[MAXVIDWIDTH];
|
||||||
INT16 screenheightarray[MAXVIDWIDTH];
|
INT16 screenheightarray[MAXVIDWIDTH];
|
||||||
|
|
||||||
|
spriteinfo_t spriteinfo[NUMSPRITES];
|
||||||
|
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
static fixed_t cosang2rad[ROTANGLES];
|
static fixed_t cosang2rad[ROTANGLES];
|
||||||
static fixed_t sinang2rad[ROTANGLES];
|
static fixed_t sinang2rad[ROTANGLES];
|
||||||
|
@ -217,7 +219,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
void R_CacheRotSprite(spriteframe_t *sprframe, INT32 rot, UINT8 flip)
|
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteframe_t *sprframe, INT32 rot, UINT8 flip)
|
||||||
{
|
{
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
INT32 angle;
|
INT32 angle;
|
||||||
|
@ -251,8 +253,13 @@ void R_CacheRotSprite(spriteframe_t *sprframe, INT32 rot, UINT8 flip)
|
||||||
height = patch->height;
|
height = patch->height;
|
||||||
|
|
||||||
// rotation pivot
|
// rotation pivot
|
||||||
px = SPRITE_XCENTER; //22;
|
px = SPRITE_XCENTER;
|
||||||
py = SPRITE_YCENTER; //47;
|
py = SPRITE_YCENTER;
|
||||||
|
if (spriteinfo[sprnum].available)
|
||||||
|
{
|
||||||
|
px = spriteinfo[sprnum].pivot[frame].x;
|
||||||
|
py = spriteinfo[sprnum].pivot[frame].y;
|
||||||
|
}
|
||||||
if (flip)
|
if (flip)
|
||||||
px = width - px;
|
px = width - px;
|
||||||
|
|
||||||
|
@ -1458,7 +1465,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
if (rollangle > 0)
|
if (rollangle > 0)
|
||||||
{
|
{
|
||||||
if (!sprframe->rotsprite.cached[rot])
|
if (!sprframe->rotsprite.cached[rot])
|
||||||
R_CacheRotSprite(sprframe, rot, flip);
|
R_CacheRotSprite(thing->sprite, thing->frame, sprframe, rot, flip);
|
||||||
rollangle /= ROTANGDIFF;
|
rollangle /= ROTANGDIFF;
|
||||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||||
if (rotsprite != NULL)
|
if (rotsprite != NULL)
|
||||||
|
|
|
@ -53,7 +53,7 @@ void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight);
|
||||||
void R_AddSpriteDefs(UINT16 wadnum);
|
void R_AddSpriteDefs(UINT16 wadnum);
|
||||||
|
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
void R_CacheRotSprite(spriteframe_t *sprframe, INT32 rot, UINT8 flip);
|
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteframe_t *sprframe, INT32 rot, UINT8 flip);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//SoM: 6/5/2000: Light sprites correctly!
|
//SoM: 6/5/2000: Light sprites correctly!
|
||||||
|
@ -210,6 +210,8 @@ typedef struct vissprite_s
|
||||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
} vissprite_t;
|
} vissprite_t;
|
||||||
|
|
||||||
|
extern spriteinfo_t spriteinfo[NUMSPRITES];
|
||||||
|
|
||||||
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
||||||
// middle texture. This is used for sorting with sprites.
|
// middle texture. This is used for sorting with sprites.
|
||||||
typedef struct drawnode_s
|
typedef struct drawnode_s
|
||||||
|
|
Loading…
Reference in a new issue