Commit ca350592 authored by Steven Fuller's avatar Steven Fuller

id_heads.c, misc.c: moved some includes from id_heads to misc.c

vi_null.c: updated for the vi_comm changes

vi_sdl.c: Chuck Mason suggested using SDL_Flip instead of SDL_UpdateRect
parent b5746514
...@@ -5,11 +5,9 @@ ...@@ -5,11 +5,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h>
#include <glob.h> #include <glob.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
......
...@@ -27,8 +27,8 @@ int xfrac, yfrac; ...@@ -27,8 +27,8 @@ int xfrac, yfrac;
boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, unsigned frames, boolean abortable) boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, unsigned frames, boolean abortable)
{ {
int pixperframe; int pixperframe;
unsigned x, y, p, frame; int x, y, p, frame;
long rndval; unsigned int rndval;
int retr; int retr;
rndval = 1; rndval = 1;
...@@ -44,6 +44,8 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un ...@@ -44,6 +44,8 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un
retr = -1; retr = -1;
/* VL_DirectPlotInit(); */
do { do {
if (abortable && IN_CheckAck()) if (abortable && IN_CheckAck())
retr = true; retr = true;
...@@ -70,6 +72,7 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un ...@@ -70,6 +72,7 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un
} }
} }
VL_DirectPlotFlush(); VL_DirectPlotFlush();
frame++; frame++;
...@@ -287,9 +290,10 @@ void VW_DrawPropString(char *string) ...@@ -287,9 +290,10 @@ void VW_DrawPropString(char *string)
} }
} }
static void VWL_MeasureString(char *string, word *width, word *height, byte *font) void VW_MeasurePropString(char *string, word *width, word *height)
{ {
int w, mw; int w, mw;
byte *font = grsegs[STARTFONT+fontnumber];
w = 0; w = 0;
mw = 0; mw = 0;
...@@ -311,11 +315,6 @@ static void VWL_MeasureString(char *string, word *width, word *height, byte *fon ...@@ -311,11 +315,6 @@ static void VWL_MeasureString(char *string, word *width, word *height, byte *fon
*width = mw; *width = mw;
} }
void VW_MeasurePropString(char *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,grsegs[STARTFONT+fontnumber]);
}
void VWB_DrawTile8(int x, int y, int tile) void VWB_DrawTile8(int x, int y, int tile)
{ {
VL_MemToScreen(grsegs[STARTTILE8]+(tile*64), 8, 8, x, y); VL_MemToScreen(grsegs[STARTTILE8]+(tile*64), 8, 8, x, y);
...@@ -324,14 +323,12 @@ void VWB_DrawTile8(int x, int y, int tile) ...@@ -324,14 +323,12 @@ void VWB_DrawTile8(int x, int y, int tile)
void VWB_DrawPic(int x, int y, int chunknum) void VWB_DrawPic(int x, int y, int chunknum)
{ {
int picnum = chunknum - STARTPICS; int picnum = chunknum - STARTPICS;
unsigned width,height; int width, height;
x &= ~7;
width = pictable[picnum].width; width = pictable[picnum].width;
height = pictable[picnum].height; height = pictable[picnum].height;
VL_MemToScreen(grsegs[chunknum],width,height,x,y); VL_MemToScreen(grsegs[chunknum], width, height, x, y);
} }
/* /*
......
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include "wl_def.h" #include "wl_def.h"
/* TimeCount from David Haslam -- dch@sirius.demon.co.uk */ /* TimeCount from David Haslam -- dch@sirius.demon.co.uk */
......
This diff is collapsed.
...@@ -58,8 +58,10 @@ void VL_WaitVBL(int vbls) ...@@ -58,8 +58,10 @@ void VL_WaitVBL(int vbls)
void VW_UpdateScreen() void VW_UpdateScreen()
{ {
//VL_WaitVBL(1); //VL_WaitVBL(1);
memcpy(surface->pixels, gfxbuf, vwidth*vheight); //memcpy(surface->pixels, gfxbuf, vwidth*vheight);
SDL_UpdateRect(surface, 0, 0, 0, 0); //SDL_UpdateRect(surface, 0, 0, 0, 0);
SDL_Flip(surface);
} }
/* /*
...@@ -83,22 +85,25 @@ void VL_Startup() ...@@ -83,22 +85,25 @@ void VL_Startup()
vheight *= 3; vheight *= 3;
} }
if (gfxbuf == NULL) //if (gfxbuf == NULL)
gfxbuf = malloc(vwidth * vheight * 1); // gfxbuf = malloc(vwidth * vheight * 1);
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
Quit("Couldn't init SDL"); Quit("Couldn't init SDL");
} }
if (MS_CheckParm("fullscreen")) if (MS_CheckParm("fullscreen"))
surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN); //surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN);
surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN|SDL_DOUBLEBUF);
else else
surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE); //surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE);
surface = SDL_SetVideoMode(vwidth, vheight, 8, SDL_SWSURFACE|SDL_HWPALETTE|SDL_DOUBLEBUF);
if (surface == NULL) { if (surface == NULL) {
SDL_Quit(); SDL_Quit();
Quit ("Couldn't set 320x200 mode"); Quit("Couldn't set 320x200 mode");
} }
gfxbuf = surface->pixels;
SDL_WM_SetCaption(GAMENAME, GAMENAME); SDL_WM_SetCaption(GAMENAME, GAMENAME);
...@@ -115,10 +120,10 @@ void VL_Startup() ...@@ -115,10 +120,10 @@ void VL_Startup()
void VL_Shutdown() void VL_Shutdown()
{ {
if (gfxbuf != NULL) { //if (gfxbuf != NULL) {
free(gfxbuf); // free(gfxbuf);
gfxbuf = NULL; // gfxbuf = NULL;
} //}
SDL_Quit(); SDL_Quit();
} }
...@@ -174,7 +179,8 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2) ...@@ -174,7 +179,8 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
void VL_DirectPlotFlush() void VL_DirectPlotFlush()
{ {
SDL_UpdateRect(surface, 0, 0, 0, 0); //SDL_UpdateRect(surface, 0, 0, 0, 0);
SDL_Flip(surface);
} }
static int XKeysymToScancode(unsigned int keysym) static int XKeysymToScancode(unsigned int keysym)
......
...@@ -151,12 +151,12 @@ void ParseTimedCommand() ...@@ -151,12 +151,12 @@ void ParseTimedCommand()
void TimedPicCommand() void TimedPicCommand()
{ {
ParseTimedCommand (); ParseTimedCommand();
// //
// update the screen, and wait for time delay // update the screen, and wait for time delay
// //
VW_UpdateScreen (); VW_UpdateScreen();
// //
// wait for time // wait for time
...@@ -167,7 +167,7 @@ void TimedPicCommand() ...@@ -167,7 +167,7 @@ void TimedPicCommand()
// //
// draw pic // draw pic
// //
VWB_DrawPic (picx&~7,picy,picnum); VWB_DrawPic(picx&~7, picy, picnum);
} }
...@@ -234,7 +234,7 @@ void HandleCommand() ...@@ -234,7 +234,7 @@ void HandleCommand()
break; break;
case 'T': // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic case 'T': // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic
TimedPicCommand (); TimedPicCommand();
break; break;
case 'G': // ^Gyyy,xxx,ppp draws graphic case 'G': // ^Gyyy,xxx,ppp draws graphic
......
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