Commit 88291afa authored by Steven Fuller's avatar Steven Fuller

More changes for GL and start of Motif frontends

parent 31fb323b
...@@ -185,7 +185,7 @@ void RedrawScreen() ...@@ -185,7 +185,7 @@ void RedrawScreen()
BlastScreen(); BlastScreen();
} }
void DrawShape(Word x, Word y, void *ShapePtr) void ShowGetPsyched()
{ {
} }
...@@ -193,6 +193,22 @@ void DrawPsyched(Word Index) ...@@ -193,6 +193,22 @@ void DrawPsyched(Word Index)
{ {
} }
void EndGetPsyched()
{
}
void InitInterMisPic()
{
}
void DrawInterMisPic(Word index)
{
}
void FreeInitMisPic()
{
}
void DisplayScreen(Word res, Word pres) void DisplayScreen(Word res, Word pres)
{ {
LongWord *PackPtr; LongWord *PackPtr;
...@@ -813,20 +829,32 @@ void IO_AttackShape(Word shape) ...@@ -813,20 +829,32 @@ void IO_AttackShape(Word shape)
void DrawSprite(thing_t *t) void DrawSprite(thing_t *t)
{ {
static GLfloat arr[16] = { 1.0, 0.0, 0.5, 1.0, 1.0, 1.0, 0.5, -1.0,
0.0, 1.0, -0.5, -1.0, 0.0, 0.0, -0.5, 1.0
};
glPushMatrix(); glPushMatrix();
glTranslatef(-(GLfloat)t->x / 256.0, 0, -(GLfloat)t->y / 256.0); glTranslatef(-(GLfloat)t->x / 256.0, 0, -(GLfloat)t->y / 256.0);
glRotatef(90.0+((GLfloat)gamestate.viewangle / (GLfloat)ANGLES * 360.0), 0.0, 1.0, 0.0); glRotatef(90.0+((GLfloat)gamestate.viewangle / (GLfloat)ANGLES * 360.0), 0.0, 1.0, 0.0);
ChangeTextureSimple(sprtex[t->sprite]); ChangeTextureSimple(sprtex[t->sprite]);
glBegin(GL_QUADS); glBegin(GL_QUADS);
#if 0
glTexCoord2f(1.0, 0.0); glVertex2f( 0.5, 1); glTexCoord2f(1.0, 0.0); glVertex2f( 0.5, 1);
glTexCoord2f(1.0, 1.0); glVertex2f( 0.5, -1); glTexCoord2f(1.0, 1.0); glVertex2f( 0.5, -1);
glTexCoord2f(0.0, 1.0); glVertex2f(-0.5, -1); glTexCoord2f(0.0, 1.0); glVertex2f(-0.5, -1);
glTexCoord2f(0.0, 0.0); glVertex2f(-0.5, 1); glTexCoord2f(0.0, 0.0); glVertex2f(-0.5, 1);
#else
glTexCoord2fv(&arr[0]); glVertex2fv(&arr[2]);
glTexCoord2fv(&arr[4]); glVertex2fv(&arr[6]);
glTexCoord2fv(&arr[8]); glVertex2fv(&arr[10]);
glTexCoord2fv(&arr[12]); glVertex2fv(&arr[14]);
#endif
glEnd(); glEnd();
glPopMatrix(); glPopMatrix();
} }
......
...@@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern Word NumberIndex; /* Hack for drawing numbers */ extern Word NumberIndex; /* Hack for drawing numbers */
static LongWord BJTime; /* Time to draw BJ? */ static LongWord BJTime; /* Time to draw BJ? */
static Word WhichBJ; /* Which BJ to show */ static Word WhichBJ; /* Which BJ to show */
static LongWord Indexs[3]; /* Offsets to BJ's true shapes */
static Byte *BJPtr; /* Pointer to BJ's shapes */
static Word ParTime; /* Par time for level */ static Word ParTime; /* Par time for level */
static LongWord BonusScore; /* Additional points */ static LongWord BonusScore; /* Additional points */
...@@ -46,7 +44,6 @@ static LongWord BonusScore; /* Additional points */ ...@@ -46,7 +44,6 @@ static LongWord BonusScore; /* Additional points */
**********************************/ **********************************/
static Rect BJRect = {48,73,48+142,73+131}; /* Rect for BJ's picture */
static void ShowBJ(void) static void ShowBJ(void)
{ {
if ((ReadTick()-BJTime) >= 20) { /* Time to draw a BJ? */ if ((ReadTick()-BJTime) >= 20) { /* Time to draw a BJ? */
...@@ -54,8 +51,7 @@ static void ShowBJ(void) ...@@ -54,8 +51,7 @@ static void ShowBJ(void)
if (WhichBJ!=2) { /* Thumbs up? */ if (WhichBJ!=2) { /* Thumbs up? */
WhichBJ ^= 1; /* Nope, toggle breathing */ WhichBJ ^= 1; /* Nope, toggle breathing */
} }
DrawShape(73,48,&BJPtr[Indexs[WhichBJ]]); /* Draw BJ */ DrawInterMisPic(WhichBJ);
BlastScreen2(&BJRect); /* Update video */
} }
} }
...@@ -229,8 +225,6 @@ static void RollRatio(Word x,Word y,Word ratio) ...@@ -229,8 +225,6 @@ static void RollRatio(Word x,Word y,Word ratio)
void LevelCompleted(void) void LevelCompleted(void)
{ {
Word k; Word k;
LongWord *PackPtr;
LongWord PackLength;
/* setup */ /* setup */
...@@ -244,17 +238,8 @@ void LevelCompleted(void) ...@@ -244,17 +238,8 @@ void LevelCompleted(void)
DisplayScreen(rIntermission, rInterPal); DisplayScreen(rIntermission, rInterPal);
BlastScreen(); BlastScreen();
PackPtr = LoadAResource(rInterPics); InitInterMisPic();
PackLength = lMSB(PackPtr[0]);
BJPtr = (Byte *)AllocSomeMem(PackLength);
DLZSS(BJPtr,(Byte *) &PackPtr[1],PackLength);
ReleaseAResource(rInterPics);
memcpy(Indexs,BJPtr,12); /* Copy the index table */
Indexs[0] = lMSB(Indexs[0]);
Indexs[1] = lMSB(Indexs[1]);
Indexs[2] = lMSB(Indexs[2]);
WhichBJ = 0; /* Init BJ */ WhichBJ = 0; /* Init BJ */
BJTime = ReadTick()-50; /* Force a redraw */ BJTime = ReadTick()-50; /* Force a redraw */
BlastScreen(); /* Draw the screen */ BlastScreen(); /* Draw the screen */
...@@ -315,8 +300,10 @@ void LevelCompleted(void) ...@@ -315,8 +300,10 @@ void LevelCompleted(void)
do { do {
ShowBJ(); /* Animate BJ */ ShowBJ(); /* Animate BJ */
} while (!WaitTicksEvent(1)); /* Wait for a keypress */ } while (!WaitTicksEvent(1)); /* Wait for a keypress */
FreeSomeMem(BJPtr); /* Release BJ's shapes */
FadeToBlack(); /* Fade away */ FadeToBlack(); /* Fade away */
FreeInitMisPic();
IntermissionHack = FALSE; /* Release the hack */ IntermissionHack = FALSE; /* Release the hack */
NumberIndex = 36; /* Restore the index */ NumberIndex = 36; /* Restore the index */
} }
......
...@@ -14,50 +14,68 @@ SOFTOBJS = RefSprite.o SoftDraw.o SoftDraw2.o ...@@ -14,50 +14,68 @@ SOFTOBJS = RefSprite.o SoftDraw.o SoftDraw2.o
OGLOBJS = GLDraw.o OGLOBJS = GLDraw.o
SOBJS = $(OBJS) $(SOFTOBJS) vi_svga.o SOBJS = $(OBJS) $(SOFTOBJS) vi_svga.o
XOBJS = $(OBJS) $(SOFTOBJS) vi_xlib.o XOBJS = $(OBJS) $(SOFTOBJS) vi_xlib.o
XMOBJS = $(OBJS) $(SOFTOBJS) vi_xm.o
GOBJS = $(OBJS) $(SOFTOBJS) vi_gtk.o GOBJS = $(OBJS) $(SOFTOBJS) vi_gtk.o
GLOBJS = $(OBJS) $(OGLOBJS) vi_glx.o GLOBJS = $(OBJS) $(OGLOBJS) vi_glx.o
GLXMOBJS = $(OBJS) $(OGLOBJS) vi_glxm.o
LFLAGS = -lm LFLAGS = -lm
#LFLAGS = -lm /home/relnev/ElectricFence-2.1/libefence.a #LFLAGS = -lm /home/relnev/ElectricFence-2.1/libefence.a
#LFLAGS = -lm /home/relnev/ElectricFence-2.2.2/libefence.a -lpthread #LFLAGS = -lm /home/relnev/ElectricFence-2.2.2/libefence.a -lpthread
SLFLAGS = $(LFLAGS) -lvga SLFLAGS = $(LFLAGS) -lvga
#XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga #XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga
XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11
GLFLAGS = $(LFLAGS) `gtk-config --libs` # -L/usr/X11R6/lib -lX11 -lXi -lXext -lgdk -lgtk XMLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -L/usr/local/motif/lib
GLLFLAGS = $(LFLAGS) -L/usr/lib -L/usr/X11R6/lib -lX11 -lXext -lGL GLFLAGS = $(LFLAGS) `gtk-config --libs` # -L/usr/X11R6/lib -lX11 -lXi -lXext -lgdk -lgtk
GLLFLAGS = $(LFLAGS) -L/usr/lib -L/usr/X11R6/lib -lX11 -lXext -lGL
GLXMLFLAGS = $(LFLAGS) -L/usr/lib -L/usr/X11R6/lib -L/usr/local/motif/lib -lX11 -lXext -lGL
NASM = nasm NASM = nasm
.SUFFIXES: .asm .SUFFIXES: .asm
all: swolf3d xwolf3d gwolf3d glwolf3d all: swolf3d xwolf3d xmwolf3d gwolf3d glwolf3d glxmwolf3d
$(SOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h $(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 $(XOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(XMOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(GOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h $(GOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(GLOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h $(GLOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(GLXMOBJS): Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
.asm.o: .asm.o:
$(NASM) -f elf -o $@ $< $(NASM) -f elf -o $@ $<
vi_xm.o: vi_xm.c
gcc -c vi_xm.c $(CFLAGS) -I/usr/local/motif/include
vi_gtk.o: vi_gtk.c vi_gtk.o: vi_gtk.c
gcc -c vi_gtk.c $(CFLAGS) `gtk-config --cflags` gcc -c vi_gtk.c $(CFLAGS) `gtk-config --cflags`
vi_glxm.o: vi_glxm.c
gcc -c vi_glxm.c $(CFLAGS) -I/usr/local/motif/include
swolf3d: $(SOBJS) swolf3d: $(SOBJS)
gcc -o swolf3d $(SOBJS) $(SLFLAGS) gcc -o swolf3d $(SOBJS) $(SLFLAGS)
xwolf3d: $(XOBJS) xwolf3d: $(XOBJS)
gcc -o xwolf3d $(XOBJS) $(XLFLAGS) gcc -o xwolf3d $(XOBJS) $(XLFLAGS)
xmwolf3d: $(XMOBJS)
gcc -o xmwolf3d $(XMOBJS) $(XMLFLAGS)
gwolf3d: $(GOBJS) gwolf3d: $(GOBJS)
gcc -o gwolf3d $(GOBJS) $(GLFLAGS) gcc -o gwolf3d $(GOBJS) $(GLFLAGS)
glwolf3d: $(GLOBJS) glwolf3d: $(GLOBJS)
gcc -o glwolf3d $(GLOBJS) $(GLLFLAGS) gcc -o glwolf3d $(GLOBJS) $(GLLFLAGS)
glxmwolf3d: $(GLXMOBJS)
gcc -o glxmwolf3d $(GLXMOBJS) $(GLXMLFLAGS)
clean: clean:
rm -rf swolf3d xwolf3d gwolf3d glwolf3d *.o rm -rf swolf3d xwolf3d gwolf3d glwolf3d xmwolf3d glxmwolf3d *.o
distclean: clean distclean: clean
rm -rf core *~ DEADJOE rm -rf core *~ DEADJOE
......
...@@ -4,7 +4,7 @@ Wolfenstein 3D is an Id Software game. This is a port of the Macintosh ...@@ -4,7 +4,7 @@ Wolfenstein 3D is an Id Software game. This is a port of the Macintosh
version that was released by MacPlay in 1994. You can find information about version that was released by MacPlay in 1994. You can find information about
the source release at: http://www.maccentral.com/news/0001/24.wolf3d.shtml the source release at: http://www.maccentral.com/news/0001/24.wolf3d.shtml
WolfReadMe.txt, from that Mac Wolf3d source release, is also included with WolfReadMe.txt, from that Mac Wolf3d source release, is also included with
this port. this port. This port is not supported by id Software.
Goals of this Project (Just what am I trying to do?): Like the PC verison, Goals of this Project (Just what am I trying to do?): Like the PC verison,
this game (I consider the PC and Mac versions as different games) was only this game (I consider the PC and Mac versions as different games) was only
...@@ -59,19 +59,20 @@ the specifics. ...@@ -59,19 +59,20 @@ the specifics.
Specifically: Specifically:
swolf3d : The SVGAlib Version. Only supports 320x200x256 at the moment, so swolf3d : The SVGAlib Version. Only supports 320x200x256 at the moment, so
only parts of the intro screens are shown (they are 512x384). only parts of the intro screens are shown (they are 512x384). [Actually
now you can use different resolutions, but I'm not sure how stable it is.]
xwolf3d : The Xlib Version. Only supports 8bpp PseudoColor visuals. xwolf3d : The Xlib Version. Only supports 8bpp PseudoColor visuals. Window
only at this time.
gwolf3d : The gtk+ Version. Only supports 8bpp visuals, but has a menu that gwolf3d : The gtk+ Version. Only supports 8bpp visuals, but has a menu that
has a Quit option. I currently don't really like gtk+; anyone know of a has a Quit option. I currently don't really like gtk+; anyone know of a
more complete api reference than the one on http://www.gtk.org? But I'll more complete api reference than the one on http://www.gtk.org? But I'll
use it so I can have menus and dialogs without having to create them in Xlib. have to use it so I can have menus and dialogs without having to create them
Any suggestions? in Xlib. Any suggestions?
glwolf3d: The OpenGL Version (written using Xlib w/ GLX). I like it. Not glwolf3d: The OpenGL Version (written using Xlib w/ GLX). I like it. Not
all graphics are currently shown (So when you have a blank screen, press all graphics are currently shown, and a few things are still rough.
enter a few times to get passed the screens).
Note: The available targets (binaries) may change over time as I decide Note: The available targets (binaries) may change over time as I decide
which APIs work the best, etc. which APIs work the best, etc.
......
...@@ -36,6 +36,75 @@ void InitYTable(void) ...@@ -36,6 +36,75 @@ void InitYTable(void)
} while (++i<480); } while (++i<480);
} }
static LongWord PsyTime;
void ShowGetPsyched(void)
{
LongWord *PackPtr;
Byte *ShapePtr;
LongWord PackLength;
Word X,Y;
PsyTime = ReadTick() + 60*2;
ClearTheScreen(BLACK);
BlastScreen();
PackPtr = LoadAResource(rGetPsychPic);
PackLength = lMSB(PackPtr[0]);
ShapePtr = AllocSomeMem(PackLength);
DLZSS(ShapePtr,(Byte *) &PackPtr[1],PackLength);
X = (VidWidth-224)/2;
Y = (ViewHeight-56)/2;
DrawShape(X,Y,ShapePtr);
FreeSomeMem(ShapePtr);
ReleaseAResource(rGetPsychPic);
BlastScreen();
SetAPalette(rGamePal);
}
void EndGetPsyched(void)
{
while (PsyTime > ReadTick()) ;
SetAPalette(rBlackPal);
}
/*
The intermission picture (BJ)
*/
static LongWord Indexs[3]; /* Offsets to BJ's true shapes */
static Byte *BJPtr; /* Pointer to BJ's shapes */
void InitInterMisPic()
{
LongWord *PackPtr;
LongWord PackLength;
PackPtr = LoadAResource(rInterPics);
PackLength = lMSB(PackPtr[0]);
BJPtr = (Byte *)AllocSomeMem(PackLength);
DLZSS(BJPtr, (Byte *)&PackPtr[1], PackLength);
ReleaseAResource(rInterPics);
memcpy(Indexs,BJPtr,12); /* Copy the index table */
Indexs[0] = lMSB(Indexs[0]);
Indexs[1] = lMSB(Indexs[1]);
Indexs[2] = lMSB(Indexs[2]);
}
static Rect BJRect = {48,73,48+142,73+131}; /* Rect for BJ's picture */
void DrawInterMisPic(Word index)
{
DrawShape(BJRect.left, BJRect.top, &BJPtr[Indexs[index]]);
BlastScreen2(&BJRect);
}
void FreeInitMisPic()
{
FreeSomeMem(BJPtr); /* Release BJ's shapes */
}
void DisplayScreen(Word res, Word pal) void DisplayScreen(Word res, Word pal)
{ {
LongWord *PackPtr; LongWord *PackPtr;
...@@ -201,9 +270,9 @@ void IO_ScaleWallColumn(Word x, Word scale, Word tile, Word column) ...@@ -201,9 +270,9 @@ void IO_ScaleWallColumn(Word x, Word scale, Word tile, Word column)
} }
typedef struct { typedef struct {
SWord Topy; ShortWord Topy;
SWord Boty; ShortWord Boty;
SWord Shape; ShortWord Shape;
} PACKED SpriteRun; } PACKED SpriteRun;
void IO_ScaleMaskedColumn(Word x,Word scale, unsigned short *CharPtr,Word column) void IO_ScaleMaskedColumn(Word x,Word scale, unsigned short *CharPtr,Word column)
......
...@@ -23,9 +23,9 @@ TODO: ...@@ -23,9 +23,9 @@ TODO:
- Is GL_REPLACE faster than GL_MODULATE for textures? - Is GL_REPLACE faster than GL_MODULATE for textures?
- Save "draw state" so redrawing works right when screen is - Save "draw state" so redrawing works right when screen is
resized/exposed resized/exposed
- What about using CVAs for the Walls - when loading level create a - GLX 1.3?
CVA with every wall entry, then just reference the right one (go by BSP - As an experiement, see if adding CVAs to the wall code will speed
number) anything up?
* Documentation * Documentation
* Sound! * Sound!
- Need to write sound playing code (probably access /dev/dsp directly - Need to write sound playing code (probably access /dev/dsp directly
......
...@@ -24,7 +24,7 @@ typedef unsigned int Word; ...@@ -24,7 +24,7 @@ typedef unsigned int Word;
typedef unsigned long LongWord; typedef unsigned long LongWord;
typedef unsigned char Byte; typedef unsigned char Byte;
typedef unsigned char Boolean; typedef unsigned char Boolean;
typedef unsigned short int SWord; typedef unsigned short int ShortWord;
#define BLACK 255 #define BLACK 255
#define DARKGREY 250 #define DARKGREY 250
......
...@@ -81,39 +81,6 @@ void PrintTimeCounter(TimeCounter *t, char *header) ...@@ -81,39 +81,6 @@ void PrintTimeCounter(TimeCounter *t, char *header)
printf("Min: %lu, max:%lu\n", t->mintime, t->maxtime); printf("Min: %lu, max:%lu\n", t->mintime, t->maxtime);
} }
LongWord PsyTime;
void ShowGetPsyched(void)
{
LongWord *PackPtr;
Byte *ShapePtr;
LongWord PackLength;
Word X,Y;
PsyTime = ReadTick() + 60*2;
ClearTheScreen(BLACK);
BlastScreen();
PackPtr = LoadAResource(rGetPsychPic);
PackLength = lMSB(PackPtr[0]);
ShapePtr = AllocSomeMem(PackLength);
DLZSS(ShapePtr,(Byte *) &PackPtr[1],PackLength);
X = (VidWidth-224)/2;
Y = (ViewHeight-56)/2;
DrawShape(X,Y,ShapePtr);
FreeSomeMem(ShapePtr);
ReleaseAResource(rGetPsychPic);
BlastScreen();
SetAPalette(rGamePal);
}
void EndGetPsyched(void)
{
while (PsyTime > ReadTick()) ;
SetAPalette(rBlackPal);
}
void ShareWareEnd(void) void ShareWareEnd(void)
{ {
SetAPalette(rGamePal); SetAPalette(rGamePal);
......
This diff is collapsed.
This diff is collapsed.
...@@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PACKED __attribute__((packed)) #define PACKED __attribute__((packed))
typedef struct { typedef struct {
int left;
int top; int top;
int right; int left;
int bottom; int bottom;
int right;
} Rect; } Rect;
...@@ -584,6 +584,7 @@ extern Boolean rw_downside; /* True for dir_east and dir_south*/ ...@@ -584,6 +584,7 @@ extern Boolean rw_downside; /* True for dir_east and dir_south*/
extern Byte *ArtData[64]; extern Byte *ArtData[64];
extern Byte textures[MAPSIZE*2+5][MAPSIZE]; /* 0-63 is horizontal, 64-127 is vertical*/ extern Byte textures[MAPSIZE*2+5][MAPSIZE]; /* 0-63 is horizontal, 64-127 is vertical*/
extern void SetPalette(Byte *pal); extern void SetPalette(Byte *pal);
extern void DisplayScreen(Word res, Word pal); extern void DisplayScreen(Word res, Word pal);
extern void InitRenderView(); extern void InitRenderView();
...@@ -597,6 +598,10 @@ extern void FreeResources(); ...@@ -597,6 +598,10 @@ extern void FreeResources();
extern void RedrawScreen(); extern void RedrawScreen();
extern Boolean SaveGame(char *file); extern Boolean SaveGame(char *file);
extern Boolean LoadGame(char *file); extern Boolean LoadGame(char *file);
extern void InitInterMisPic();
extern void DrawInterMisPic(Word index);
extern void FreeInitMisPic();
extern void BlastScreen(void); extern void BlastScreen(void);
extern void BlastScreen2(Rect *BlastRect); extern void BlastScreen2(Rect *BlastRect);
......
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