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