Commit 1536ef2c authored by Steven Fuller's avatar Steven Fuller

* Temp SDL file

* Considered ideas about sound/music
* FindResource is a kinder LoadAResource2: I believe that using LoadAResource2
means that the resource exists (instead of crashing soon after loading a
bogus resource, error when attempted -- helps detects false resource forks).
FindResource will return NULL if the requested resource is not found, so the
sound/music player can check csnd then snd for the data it wants.
parent 978b9123
......@@ -888,8 +888,8 @@ void P_DrawSeg(saveseg_t *seg)
Word segplane;
Word door;
door_t *door_p;
unsigned short span, tspan;
unsigned short angle1, angle2;
unsigned short span, tspan;
unsigned short angle1 = 0, angle2 = 0;
WallSeen = 0;
......
CC = gcc
#CC = g++
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall
CFLAGS = -g -Wall -ansi -pedantic
#CFLAGS = -g -Wall -ansi -pedantic
#CFLAGS = -g
#CFLAGS = -Os -g
#CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include
......
......@@ -124,7 +124,7 @@ void DrawAutomap(Word tx,Word ty)
{
Word i, tile;
saveseg_t *seg;
Word x,y,xstep,ystep,count;
Word x = 0, y = 0, xstep = 0, ystep = 0, count;
Word min,max;
Word maxtx, maxty;
Word NodeCount;
......@@ -378,7 +378,7 @@ void NewMap(void)
void StartPushWall(void)
{
Word i;
Word segdir,segplane,segmin;
Word segdir = 0, segplane = 0, segmin = 0;
saveseg_t *SavePtr; /* Temp pointer */
pwallseg = 0; /* No pushwalls in progress */
......
......@@ -607,9 +607,9 @@ void P_DrawSeg (saveseg_t *seg)
Word door;
door_t *door_p;
unsigned short span, tspan;
unsigned short angle1, angle2;
unsigned short angle1 = 0, angle2 = 0;
int texslide;
int distance;
int distance = 0;
if (seg->dir & DIR_DISABLEDFLAG) { /* Segment shut down? */
return; /* pushwall part*/
......
TODO:
* Pause key
* SVGAlib Hack:
- Require 320x200x256
- If user requests a gamemode which SVGAlib says it does not support, fail
- If SVGAlib does not support 512x384x256, allow the user to pan around
- Check to make sure linear addressing is supported
+ If SVGAlib does not support 512x384x256, allow the user to pan around
with the keypad arrow keys if only mode supported 320x200x256 (center if
640x400 or 480 is supported?)
- Have a "force no 512 mode" for those who do not want mode changing.
* Finish moving all 2D code to SoftDraw.c
* Finish OpenGL
+ Status bars, Introscreens [DrawShape]
......@@ -21,13 +22,22 @@ TODO:
* Sound!
- Need to write sound playing code (probably access /dev/dsp directly
since this source does not have any code for determining sound position).
- Music is planned.
- Check 'csnd' for a sample, then 'snd ' if not found.
+ Music is planned.
- Midi support would be not hard, all that would be needed is something
that can get the note ons and then play the notes at the right time.
(the songs seem to only use note ons and the instruments correspond to
sample numbers, not midi instruments. If the final result does not
sound "desirable," go with Plan B)
* Interface
+ Menus and dialog boxes
- Command line (temporary workaround for no menus).
+ Command line (temporary workaround for no menus).
- Resolution
- Difficulty
- Text only menus (similar to what snes9x has).
* Different depths/visuals for software clients.
* Get it to compile/work with g++ if it is not too much trouble.
* SDL version (software)
BUGS:
* Software Drawing seems like its imprecise, stationary sprites move back and
......
......@@ -87,6 +87,7 @@ void *LoadAResource(Word RezNum);
void ReleaseAResource(Word RezNum);
void KillAResource(Word RezNum);
void *LoadAResource2(Word RezNum,LongWord Type);
void *FindResource(Word RezNum, LongWord Type);
void ReleaseAResource2(Word RezNum,LongWord Type);
void KillAResource2(Word RezNum,LongWord Type);
......
......@@ -145,6 +145,35 @@ void *LoadAResource2(Word RezNum, LongWord Type)
exit(EXIT_FAILURE);
}
void *FindResource(Word RezNum, LongWord Type)
{
ResItem *c = lr;
while (c != NULL) {
if ( (c->type == Type) && (c->item == RezNum) ) {
if (c->buf == NULL) {
c->buf = malloc(c->size);
memcpy(c->buf, c->dat, c->size);
} else {
/* DEBUG: we want a fresh copy... */
printf("DEBUG: Item %ld/%d already loaded!\n", Type, RezNum);
free(c->buf);
c->buf = malloc(c->size);
memcpy(c->buf, c->dat, c->size);
}
if (c->buf == NULL)
Quit("MALLOC FAILED?");
return c->buf;
}
c = c->next;
}
return NULL;
}
void ReleaseAResource2(Word RezNum, LongWord Type)
{
ResItem *c = lr;
......
......@@ -117,6 +117,7 @@ void FixMapList(maplist_t *m)
void InitData()
{
/*
InitSoundMusicSystem(8,8,5, 11025);
SoundListPtr = (Word *) LoadAResource(MySoundList);
......
......@@ -70,12 +70,12 @@ int main(int argc, char *argv[])
while ((opt = getopt(argc, argv, "v")) != -1) {
switch(opt) {
case 'v':
verbose = 1;
break;
default:
fprintf(stderr, "%d (%c) is unknown to me\n", opt, opt);
break;
case 'v':
verbose = 1;
break;
default:
fprintf(stderr, "%d (%c) is unknown to me\n", opt, opt);
break;
}
}
......
/*
Copyright (C) 1992-1994 Id Software, Inc.
Copyright (C) 2000 Steven Fuller <relnev@atdot.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sdl.h>
#include "wolfdef.h"
/*
This is currently unimplemented.
*/
int main(int argc, char *argv[])
{
fprintf(stderr, "TO BE IMPLEMENTED\n");
}
......@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <vga.h>
#include <vgakeyboard.h>
......@@ -30,24 +31,65 @@ Byte *gfxbuf;
void keyboard_handler(int key, int press);
int VidModes[] = { G320x200x256, G512x384x256, G640x400x256, G640x480x256 };
int main(int argc, char *argv[])
{
if (argc != 2) {
int opt, vidmode = 0;
int i;
while ((opt = getopt(argc, argv, "s:")) != -1) {
switch(opt) {
case 's': /* Set video mode (resolution) */
vidmode = atoi(optarg);
if ((vidmode < 0) && (vidmode > 3)) {
fprintf(stderr, "Invalid video mode %d\n", vidmode);
exit(EXIT_FAILURE);
}
break;
case ':':
fprintf(stderr, "option needs a parameter: %c\n", optopt);
break;
case '?':
fprintf(stderr, "unknown option: %c\n", optopt);
break;
default:
fprintf(stderr, "%d (%c) is unknown to me\n", opt, opt);
break;
}
}
if ((argc - optind) != 1) {
fprintf(stderr, "usage: %s <mac wolf3d resource fork>\n", argv[0]);
exit(EXIT_FAILURE);
}
vga_init();
if (InitResources(argv[1])) {
fprintf(stderr, "could not load %s\n", argv[1]);
if (!vga_hasmode(G320x200x256)) {
fprintf(stderr, "SVGAlib says 320x200x256 is not supported...\n");
exit(EXIT_FAILURE);
}
for (i = 1; i < 4; i++) {
if (!vga_hasmode(VidModes[i]))
VidModes[i] = -1;
}
if (VidModes[vidmode] == -1) {
fprintf(stderr, "Video mode %d is not supported...\n", vidmode);
exit(EXIT_FAILURE);
}
if (InitResources(argv[optind])) {
fprintf(stderr, "could not load %s\n", argv[optind]);
exit(EXIT_FAILURE);
}
InitData();
NewGameWindow(0); /* 320x200 */
GameViewSize = vidmode;
NewGameWindow(GameViewSize);
keyboard_init(); /* keyboard must be init'd after vga_setmode .. */
keyboard_seteventhandler(keyboard_handler);
......@@ -81,10 +123,9 @@ void SetPalette(Byte *pal)
int i;
vga_waitretrace();
#ifndef NOVGA
for (i = 0; i < 256; i++)
vga_setpalette(i, pal[i*3+0] >> 2, pal[i*3+1] >> 2, pal[i*3+2] >> 2);
#endif
}
void BlastScreen2(Rect *BlastRect)
......@@ -97,21 +138,21 @@ int VidWidth, VidHeight, ViewHeight;
#define h VidHeight
#define v ViewHeight
int vh, vw;
void BlastScreen()
{
Byte *ptrs = gfxbuf, *ptrd = graph_mem;
int i;
#ifndef NOVGA
Byte *ptrs = gfxbuf, *ptrd = vga_getgraphmem();
int i, hm, wm;
for (i = 0; i < 200; i++) {
memcpy(ptrd, ptrs, 320);
wm = (w > vw) ? vw : w;
hm = (h > vh) ? vh : h;
for (i = 0; i < hm; i++) {
memcpy(ptrd, ptrs, wm);
ptrs += w;
ptrd += 320;
ptrd += vw;
}
/* memcpy(ptrd, ptrs, w * h); */
#endif
}
Word VidXs[] = {320,512,640,640}; /* Screen sizes to play with */
......@@ -119,8 +160,7 @@ Word VidYs[] = {200,384,400,480};
Word VidVs[] = {160,320,320,400};
Word VidPics[] = {rFaceShapes,rFace512,rFace640,rFace640};
Word VidSize = -1;
int VidModes[] = { G320x200x256, G512x384x256, G640x400x256, G640x480x256 };
Word x512Hack = 0;
Word NewGameWindow(Word NewVidSize)
{
......@@ -128,37 +168,57 @@ Word NewGameWindow(Word NewVidSize)
Byte *DestPtr;
int i;
printf("Called: %d\n", NewVidSize);
/* printf("Called: %d\n", NewVidSize); */
if (NewVidSize == -1) {
fprintf(stderr, "Invalid vid size: %d\n", NewVidSize);
exit(EXIT_FAILURE);
}
if (NewVidSize == VidSize)
if (!x512Hack && (NewVidSize == VidSize))
return VidSize;
if ((NewVidSize == 1) && (VidModes[1] == -1)) {
if (VidSize == -1) {
fprintf(stderr, "Trying to set 512Hack before setting a real value!\n");
exit(EXIT_FAILURE);
}
if (x512Hack)
return VidSize;
x512Hack = 1;
} else {
x512Hack = 0;
}
printf("Setting Size: %d (from %d)\n", NewVidSize, VidSize);
/* printf("Setting Size: %d (from %d)\n", NewVidSize, VidSize); */
if (NewVidSize < 4) {
if (!x512Hack && VidModes[NewVidSize] == -1) {
fprintf(stderr, "Trying to set to an unsupported mode (%d)!\n", NewVidSize);
exit(EXIT_FAILURE);
}
w = VidXs[NewVidSize];
h = VidYs[NewVidSize];
v = VidVs[NewVidSize];
v = VidVs[NewVidSize];
} else {
fprintf(stderr, "Vid size: %d\n", NewVidSize);
fprintf(stderr, "Invalid vid size: %d\n", NewVidSize);
exit(EXIT_FAILURE);
}
if (gfxbuf)
free(gfxbuf);
gfxbuf = (Byte *)malloc(w * h);
#ifndef NOVGA
/*
if (!vga_hasmode(VidModes[NewVidSize]))
Quit("SVGAlib does not support this mode");
vga_setmode(VidModes[NewVidSize]);
vga_setlinearaddressing();
*/
vga_setmode(G320x200x256);
#endif
if (!x512Hack) {
vw = w;
vh = h;
vga_setmode(VidModes[NewVidSize]);
vga_setlinearaddressing();
vga_clear();
}
VideoPointer = gfxbuf;
VideoWidth = w;
......@@ -167,7 +227,7 @@ Word NewGameWindow(Word NewVidSize)
ClearTheScreen(BLACK);
BlastScreen();
LongPtr = (LongWord *) LoadAResource(VidPics[NewVidSize]);
LongPtr = (LongWord *)LoadAResource(VidPics[NewVidSize]);
if (GameShapes)
FreeSomeMem(GameShapes);
......
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