Commit 095e8f06 authored by Steven Fuller's avatar Steven Fuller

Honestly, hell if I know...

parent c71617f4
......@@ -196,17 +196,98 @@ void DrawPsyched(Word Index)
void EndGetPsyched()
{
}
static Texture BJPics[3];
void InitInterMisPic()
{
LongWord *PackPtr;
LongWord PackLength;
Byte *BJPtr, *Pal, *buf, *tmp;
LongWord Indexs[3];
ShortWord *Ptr;
int width, height, i;
PackPtr = LoadAResource(rInterPics);
PackLength = lMSB(PackPtr[0]);
BJPtr = (Byte *)AllocSomeMem(PackLength);
DLZSS(BJPtr, (Byte *)&PackPtr[1], PackLength);
ReleaseAResource(rInterPics);
memcpy(Indexs, BJPtr, 12);
Indexs[0] = lMSB(Indexs[0]);
Indexs[1] = lMSB(Indexs[1]);
Indexs[2] = lMSB(Indexs[2]);
Pal = LoadAResource(rInterPal);
tmp = malloc(256 * 256 * 3);
for (i = 0; i < 3; i++) {
glGenTextures(1, &BJPics[i].t);
Ptr = (ShortWord *)&BJPtr[Indexs[i]];
width = sMSB(Ptr[0]);
height = sMSB(Ptr[1]);
BJPics[i].w = width;
BJPics[i].h = height;
buf = Pal256toRGB((Byte*)&Ptr[2], width * height, Pal);
glBindTexture(GL_TEXTURE_2D, BJPics[i].t);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, tmp);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buf);
free(buf);
}
free(tmp);
ReleaseAResource(rInterPal);
FreeSomeMem(BJPtr);
}
void DrawInterMisPic(Word index)
{
GLfloat r[4] = {
-1 + (73.0 / 256.0), 1.0 - (48.0 / 192.0),
-1 + (204.0 / 256.0), 1 - (190.0 / 192.0) };
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, BJPics[index].t);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(r[0], r[1]);
glTexCoord2f(0.0f, (GLfloat)BJPics[index].h / 256.0f);
glVertex2f(r[0], r[3]);
glTexCoord2f(0.0f, (GLfloat)BJPics[index].h / 256.0f);
glTexCoord2f((GLfloat)BJPics[index].w / 256.0f, (GLfloat)BJPics[index].h / 256.0f);
glVertex2f(r[2], r[3]);
glTexCoord2f((GLfloat)BJPics[index].w / 256.0f, 0.0f);
glVertex2f(r[2], r[1]);
glEnd();
}
void FreeInitMisPic()
{
int i;
for (i = 0; i < 3; i++) {
glDeleteTextures(1, &BJPics[i].t);
BJPics[i].t = 0;
}
}
void DisplayScreen(Word res, Word pres)
......@@ -624,8 +705,8 @@ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
/* glColor3f(1.0, 1.0, 1.0); */
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glRotatef(270.0-((GLfloat)gamestate.viewangle / (GLfloat)ANGLES * 360.0), 0.0, 1.0, 0.0);
glTranslatef((GLfloat)actors[0].x / 256.0, 0, (GLfloat)actors[0].y / 256.0);
glRotatef(270.0f-((GLfloat)gamestate.viewangle / (GLfloat)ANGLES * 360.0f), 0.0, 1.0, 0.0);
glTranslatef((GLfloat)actors[0].x / 256.0f, 0.0f, (GLfloat)actors[0].y / 256.0f);
}
GLuint waltex[64];
......@@ -1379,7 +1460,7 @@ void P_DrawSegx(saveseg_t *seg)
min = 0.5;
i++;
} else {
i+=2;
i += 2;
min = 0.0;
}
max = 1.0f;
......
......@@ -35,7 +35,7 @@ NASM = nasm
.SUFFIXES: .asm
all: swolf3d xwolf3d xmwolf3d gwolf3d glwolf3d glxmwolf3d
all: swolf3d xwolf3d glwolf3d
$(SOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(XOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
......
......@@ -13,7 +13,7 @@ TODO:
* Finish moving all 2D code to SoftDraw.c
- Should move some code so it is not such a large file (SoftDraw2.c)
* Finish OpenGL
+ Status bars, Level completed screen, Psyched [DrawShape]
+ Status bars, Level completed screen, Psyched
- IO_Draw* (status bar versions) are stubbed, update statusbar when
doing screen update
- Finish window resizing
......@@ -24,8 +24,6 @@ TODO:
- Save "draw state" so redrawing works right when screen is
resized/exposed
- GLX 1.3?
- As an experiement, see if adding CVAs to the wall code will speed
anything up?
* Documentation
* Sound!
- Need to write sound playing code (probably access /dev/dsp directly
......@@ -33,7 +31,7 @@ TODO:
- Check 'csnd' for a sample, then 'snd ' if not found.
+ Music is planned.
- Output using timidity with sounds did not end up sounding good.
Probably the INST resources are used for ASDR/looping/etc...
Probably the INST resources are used for ADSR/looping/etc...
- csnd: sox -t raw -r 11025 -c 1 -w -s a.dat -r 11025 -c 1 -w -s -t wav a.wav
- snd: sox -t raw -r 11025 -c 1 -w -u a.dat -r 11025 -c 1 -w -s -t wav a.wav
- csnd might be -b -s (odd)
......@@ -61,6 +59,7 @@ TODO:
* vi_glx.c will probably be the most updated of the frontends. Be sure to
update the others later.
* Finish moving things out of stub.c
* Name conflicts between wolf3d and Xt types
BUGS:
* Software Drawing seems like its imprecise, stationary sprites move back and
......
......@@ -198,6 +198,7 @@ int main(int argc, char *argv[])
#endif
glShadeModel(GL_FLAT);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
InitData();
......
......@@ -341,30 +341,9 @@ typedef struct {
/**********************************
Static data for each sprite state
**********************************/
typedef struct {
Word sightsound; /* Sound at the sight of you */
Word deathsound; /* Sound at the death of the actor */
stateindex_t sightstate; /* State when you are sighted */
stateindex_t standstate; /* State when at rest */
stateindex_t attackstate; /* State when attacking you */
stateindex_t painstate; /* State when hit */
stateindex_t deathstate; /* State when dead */
Word points; /* Points for death */
Word speed; /* Speed of actor */
Word reactionmask; /* reaction time = 1 + w_rnd()&reactionmask*/
Word hitpoints; /* Hit points */
} classinfo_t;
enum {di_north, di_east, di_south, di_west}; /* BSP base directions */
/**********************************
The saved data structures are held in a single list, with segs being differentiated from
nodes by the presence of DIR_SEGFLAG in the dir field
The saved data structures are held in a single list, with segs being
differentiated from nodes by the presence of DIR_SEGFLAG in the dir
field.
Note... saveseg_t and savenode_t share the same memory
**********************************/
......@@ -398,6 +377,28 @@ typedef struct {
} PACKED saveseg_t;
#endif
/**********************************
Static data for each sprite state
**********************************/
typedef struct {
Word sightsound; /* Sound at the sight of you */
Word deathsound; /* Sound at the death of the actor */
stateindex_t sightstate; /* State when you are sighted */
stateindex_t standstate; /* State when at rest */
stateindex_t attackstate; /* State when attacking you */
stateindex_t painstate; /* State when hit */
stateindex_t deathstate; /* State when dead */
Word points; /* Points for death */
Word speed; /* Speed of actor */
Word reactionmask; /* reaction time = 1 + w_rnd()&reactionmask*/
Word hitpoints; /* Hit points */
} classinfo_t;
enum {di_north, di_east, di_south, di_west}; /* BSP base directions */
/**********************************
Static object struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment