LAB: Further rendering pipeline fixes

This commit is contained in:
Eugene Sandulenko 2014-12-14 17:46:40 +01:00
parent 11a7ffaabe
commit bbddd32d38
12 changed files with 116 additions and 146 deletions

View file

@ -786,7 +786,7 @@ static void process(void) {
CPtr = NULL; CPtr = NULL;
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -824,7 +824,7 @@ static void process(void) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
if (!FollowingCrumbs) if (!FollowingCrumbs)
eatMessages(); eatMessages();
@ -838,7 +838,7 @@ static void process(void) {
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
ForceDraw = false; ForceDraw = false;
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -878,13 +878,13 @@ static void process(void) {
GotMessage = true; GotMessage = true;
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
goto from_crumbs; goto from_crumbs;
} }
} }
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} else { } else {
GotMessage = true; GotMessage = true;
@ -918,7 +918,7 @@ from_crumbs:
NumCrumbs = 0; NumCrumbs = 0;
DroppingCrumbs = true; DroppingCrumbs = true;
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
} }
else if (Code == 'f' || Code == 'F' || else if (Code == 'f' || Code == 'F' ||
@ -941,7 +941,7 @@ from_crumbs:
interfaceOn(); /* Sets the correct gadget list */ interfaceOn(); /* Sets the correct gadget list */
drawPanel(); drawPanel();
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
g_system->updateScreen(); WSDL_UpdateScreen();
} }
} else { } else {
BreadCrumbs[0].RoomNum = 0; BreadCrumbs[0].RoomNum = 0;
@ -949,7 +949,7 @@ from_crumbs:
// Need to hide indicator!!!! // Need to hide indicator!!!!
mayShowCrumbIndicatorOff(); mayShowCrumbIndicatorOff();
g_system->updateScreen(); WSDL_UpdateScreen();
} }
} }
} }
@ -1068,7 +1068,7 @@ from_crumbs:
drawPanel(); drawPanel();
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -1083,7 +1083,7 @@ from_crumbs:
CPtr = NULL; CPtr = NULL;
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1107,7 +1107,7 @@ from_crumbs:
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} else { } else {
Old = ActionMode; Old = ActionMode;
@ -1130,7 +1130,7 @@ from_crumbs:
drawMessage(LOOKWHAT); drawMessage(LOOKWHAT);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -1139,7 +1139,7 @@ from_crumbs:
doUse(MAPNUM); doUse(MAPNUM);
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1165,7 +1165,7 @@ from_crumbs:
ForceDraw = true; ForceDraw = true;
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} else if (GadID == 7) { } else if (GadID == 7) {
OldRoomNum = RoomNum; OldRoomNum = RoomNum;
@ -1241,7 +1241,7 @@ from_crumbs:
} }
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -1261,7 +1261,7 @@ from_crumbs:
drawPanel(); drawPanel();
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1288,14 +1288,14 @@ from_crumbs:
drawMessage("Disk operation failed."); drawMessage("Disk operation failed.");
VGASetPal(initcolors, 8); VGASetPal(initcolors, 8);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
g_system->delayMillis(1000); g_system->delayMillis(1000);
} }
#if !defined(DOSCODE) #if !defined(DOSCODE)
else { else {
g_system->updateScreen(); WSDL_UpdateScreen();
} }
#endif #endif
@ -1312,7 +1312,7 @@ from_crumbs:
drawMessage(USEONWHAT); drawMessage(USEONWHAT);
MainDisplay = true; MainDisplay = true;
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -1332,7 +1332,7 @@ from_crumbs:
Test = getInvName(CurInv); Test = getInvName(CurInv);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1342,7 +1342,7 @@ from_crumbs:
DoNotDrawMessage = false; DoNotDrawMessage = false;
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1352,7 +1352,7 @@ from_crumbs:
DoNotDrawMessage = false; DoNotDrawMessage = false;
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1362,7 +1362,7 @@ from_crumbs:
NumCrumbs = 0; NumCrumbs = 0;
DroppingCrumbs = true; DroppingCrumbs = true;
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
} }
else if (GadID == 6) { /* follow crumbs */ else if (GadID == 6) { /* follow crumbs */
@ -1383,14 +1383,14 @@ from_crumbs:
interfaceOn(); /* Sets the correct gadget list */ interfaceOn(); /* Sets the correct gadget list */
drawPanel(); drawPanel();
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
g_system->updateScreen(); WSDL_UpdateScreen();
} else { } else {
BreadCrumbs[0].RoomNum = 0; BreadCrumbs[0].RoomNum = 0;
DroppingCrumbs = false; DroppingCrumbs = false;
// Need to hide indicator!!!! // Need to hide indicator!!!!
mayShowCrumbIndicatorOff(); mayShowCrumbIndicatorOff();
g_system->updateScreen(); WSDL_UpdateScreen();
} }
} }
} }
@ -1474,7 +1474,7 @@ from_crumbs:
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -1527,7 +1527,7 @@ from_crumbs:
drawRoomMessage(CurInv, CPtr); drawRoomMessage(CurInv, CPtr);
#if !defined(DOSCODE) #if !defined(DOSCODE)
mayShowCrumbIndicator(); mayShowCrumbIndicator();
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }

View file

@ -336,7 +336,8 @@ uint32 flowText(void *font, /* the TextAttr pointer */
} }
extern uint32 VGABASEADDRESS, VGABytesPerPage; extern uint32 VGABytesPerPage;
extern byte *VGABASEADDRESS;
/******************************************************************************/ /******************************************************************************/
@ -353,13 +354,15 @@ uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr point
uint16 x1, /* Cords */ uint16 x1, /* Cords */
uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */
uint32 res, vgabyte = VGABytesPerPage; uint32 res, vgabyte = VGABytesPerPage;
byte *tmp = VGABASEADDRESS;
//VGABASEADDRESS = (uint32)(DestIm->ImageData); VGABASEADDRESS = DestIm->ImageData;
VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height;
res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str);
VGABytesPerPage = vgabyte; VGABytesPerPage = vgabyte;
VGABASEADDRESS = tmp;
return res; return res;
} }
@ -593,7 +596,7 @@ static void doScrollBlack(void) {
setAPen(0); setAPen(0);
rectFill(0, nheight, width - 1, nheight + by - 1); rectFill(0, nheight, width - 1, nheight + by - 1);
g_system->updateScreen(); WSDL_UpdateScreen();
if (!IsHiRes) { if (!IsHiRes) {
if (nheight <= (height / 8)) if (nheight <= (height / 8))
@ -695,7 +698,7 @@ static void doScrollWipe(char *filename) {
copyPage(width, height, nheight, startline, mem); copyPage(width, height, nheight, startline, mem);
g_system->updateScreen(); WSDL_UpdateScreen();
if (!nheight) if (!nheight)
startline += by; startline += by;
@ -741,7 +744,7 @@ static void doScrollBounce(void) {
startline -= newby[counter]; startline -= newby[counter];
copyPage(width, height, 0, startline, mem); copyPage(width, height, 0, startline, mem);
g_system->updateScreen(); WSDL_UpdateScreen();
waitTOF(); waitTOF();
} }
@ -750,7 +753,7 @@ static void doScrollBounce(void) {
startline += newby1[counter - 1]; startline += newby1[counter - 1];
copyPage(width, height, 0, startline, mem); copyPage(width, height, 0, startline, mem);
g_system->updateScreen(); WSDL_UpdateScreen();
waitTOF(); waitTOF();
} }

View file

@ -56,7 +56,7 @@ LabEngine::~LabEngine() {
Common::Error LabEngine::run() { Common::Error LabEngine::run() {
// Initialize graphics using following: // Initialize graphics using following:
initGraphics(320, 200, false); initGraphics(640, 480, true);
g_music = new Music(); g_music = new Music();

View file

@ -102,6 +102,9 @@ void Music::updateMusic(void) {
void Music::fillbuffer(uint16 unit) { void Music::fillbuffer(uint16 unit) {
return;
warning("STUB: Music::fillbuffer");
uint32 Size = MUSICBUFSIZE; uint32 Size = MUSICBUFSIZE;
void *ptr = _musicBuffer[unit]; void *ptr = _musicBuffer[unit];
#if defined(DOSCODE) #if defined(DOSCODE)

View file

@ -60,7 +60,7 @@ extern uint16 RoomNum;
/* the VGA palette. */ /* the VGA palette. */
/*****************************************************************************/ /*****************************************************************************/
void setAmigaPal(uint16 *pal, uint16 numcolors) { void setAmigaPal(uint16 *pal, uint16 numcolors) {
char vgapal[16 * 3]; byte vgapal[16 * 3];
uint16 counter, vgacount; uint16 counter, vgacount;
if (numcolors > 16) if (numcolors > 16)
@ -69,11 +69,11 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) {
vgacount = 0; vgacount = 0;
for (counter = 0; counter < numcolors; counter++) { for (counter = 0; counter < numcolors; counter++) {
vgapal[vgacount] = (char)(((pal[counter] & 0xf00) >> 8) << 2); vgapal[vgacount] = (byte)(((pal[counter] & 0xf00) >> 8) << 2);
vgacount++; vgacount++;
vgapal[vgacount] = (char)(((pal[counter] & 0x0f0) >> 4) << 2); vgapal[vgacount] = (byte)(((pal[counter] & 0x0f0) >> 4) << 2);
vgacount++; vgacount++;
vgapal[vgacount] = (char)(((pal[counter] & 0x00f)) << 2); vgapal[vgacount] = (byte)(((pal[counter] & 0x00f)) << 2);
vgacount++; vgacount++;
} }
@ -733,7 +733,8 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
void processMap(uint16 CurRoom, LargeSet RoomsFound) { void processMap(uint16 CurRoom, LargeSet RoomsFound) {
uint32 Class, place = 1; uint32 Class, place = 1;
uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2; uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2;
char *sptr, newcolor[3]; char *sptr;
byte newcolor[3];
bool drawmap; bool drawmap;
struct IntuiMessage *Msg; struct IntuiMessage *Msg;
@ -894,7 +895,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) {
} }
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
} }
@ -935,7 +936,7 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) {
mouseShow(); mouseShow();
attachGadgetList(MapGadgetList); attachGadgetList(MapGadgetList);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
processMap(CurRoom, RoomsFound); processMap(CurRoom, RoomsFound);
attachGadgetList(NULL); attachGadgetList(NULL);
@ -948,7 +949,7 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) {
blackAllScreen(); blackAllScreen();
mouseShow(); mouseShow();
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }

View file

@ -295,7 +295,7 @@ void updateMouse(void) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
if (doUpdateDisplay) if (doUpdateDisplay)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
} }
@ -431,7 +431,7 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) {
getBackMouse(); getBackMouse();
drawMouse(); drawMouse();
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
MouseHidden = false; MouseHidden = false;
} }
@ -522,7 +522,7 @@ void mouseMove(uint16 x, uint16 y) {
drawMouse(); drawMouse();
VGARestorePage(); VGARestorePage();
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
QuitMouseHandler = false; QuitMouseHandler = false;
} }

View file

@ -629,7 +629,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros);
#if !defined(DOSCODE) #if !defined(DOSCODE)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
while (1) { while (1) {

View file

@ -110,7 +110,7 @@ void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool
} }
static char blackbuffer[256 * 3]; static byte blackbuffer[256 * 3];
/*****************************************************************************/ /*****************************************************************************/
/* Changes the front screen to black. */ /* Changes the front screen to black. */
@ -220,7 +220,7 @@ void diffNextFrame(void) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
if (DispBitMap->Flags & BITMAPF_VIDEO) if (DispBitMap->Flags & BITMAPF_VIDEO)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
@ -366,7 +366,7 @@ void diffNextFrame(void) {
ungetVGABaseAddr(); ungetVGABaseAddr();
if (!didTOF) if (!didTOF)
g_system->updateScreen(); WSDL_UpdateScreen();
#endif #endif
return; return;

View file

@ -1284,10 +1284,9 @@ static void addSaveSlot() {
makeThumbnail(info); makeThumbnail(info);
mouseHide(); mouseHide();
warning("STUB: addSaveSlot()"); WSDL_IgnoreUpdateDisplay(1);
//SDL_IgnoreUpdateDisplay(1);
loadBackPict("P:ModSave", false); loadBackPict("P:ModSave", false);
//SDL_IgnoreUpdateDisplay(0); WSDL_IgnoreUpdateDisplay(0);
drawSaveLoad(); drawSaveLoad();
mouseShow(); mouseShow();
} }
@ -1299,10 +1298,9 @@ static void selectSave(int n) {
g_CurSaveGameNumber = n; g_CurSaveGameNumber = n;
mouseHide(); mouseHide();
warning("STUB: selectSave()"); WSDL_IgnoreUpdateDisplay(1);
//SDL_IgnoreUpdateDisplay(1);
loadBackPict("P:ModSave", false); loadBackPict("P:ModSave", false);
//SDL_IgnoreUpdateDisplay(0); WSDL_IgnoreUpdateDisplay(0);
drawSaveLoad(); drawSaveLoad();
mouseShow(); mouseShow();
} }
@ -1312,10 +1310,9 @@ static void selectSaveSet(int n) {
g_CurSaveSet = n; g_CurSaveSet = n;
mouseHide(); mouseHide();
warning("STUB: selectSaveSet"); WSDL_IgnoreUpdateDisplay(1);
//SDL_IgnoreUpdateDisplay(1);
loadBackPict("P:ModSave", false); loadBackPict("P:ModSave", false);
//SDL_IgnoreUpdateDisplay(0); WSDL_IgnoreUpdateDisplay(0);
drawSaveLoad(); drawSaveLoad();
mouseShow(); mouseShow();
} }

View file

@ -38,7 +38,7 @@
namespace Lab { namespace Lab {
#define IS_MACOSX 1 #define IS_MACOSX 1
#define USE_SWAP 1 #define USE_NOSWAP 1
#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define INCL(BITSET,BIT) ((BITSET) |= (BIT))

View file

@ -32,6 +32,8 @@
#include "lab/stddefines.h" #include "lab/stddefines.h"
#include "lab/storage.h" #include "lab/storage.h"
#include "graphics/palette.h"
namespace Lab { namespace Lab {
//static uint16 NotInRefresh = 0; //static uint16 NotInRefresh = 0;
@ -41,11 +43,15 @@ uint32 VGAScreenWidth = 320UL,
VGAPages = 1UL, VGAPages = 1UL,
VGABytesPerPage = 65536UL; VGABytesPerPage = 65536UL;
uint32 VGABASEADDRESS = 0xA0000L; byte *VGABASEADDRESS = 0;
byte *g_DisplayBuffer = 0; byte *g_DisplayBuffer = 0;
byte *g_Pixels = 0; byte *g_Pixels = 0;
int g_ScreenWasLocked = 0;
int g_IgnoreUpdateDisplay = 0;
int g_LastWaitTOFTicks = 0;
/*****************************************************************************/ /*****************************************************************************/
/* Sets the display mode. */ /* Sets the display mode. */
@ -58,8 +64,8 @@ void setMode(char mode) {
/* Sets up either a low-res or a high-res 256 color screen. */ /* Sets up either a low-res or a high-res 256 color screen. */
/*****************************************************************************/ /*****************************************************************************/
bool createScreen(bool HiRes) { bool createScreen(bool HiRes) {
// VGABASEADDRESS = (unsigned long)malloc(640 * 480); //VGABASEADDRESS = (unsigned long)malloc(640 * 480);
VGABASEADDRESS = 1; VGABASEADDRESS = 0;
VGAScreenWidth = 640; VGAScreenWidth = 640;
VGAScreenHeight = 480; VGAScreenHeight = 480;
VGAPages = 1; VGAPages = 1;
@ -91,29 +97,37 @@ void VGARestorePage(void) {
// does nothing in SDL // does nothing in SDL
} }
void WSDL_ProcessInput() { void WSDL_ProcessInput(int state) {
} }
void waitTOF() { void waitTOF() {
int untilOutOfRefresh = 1; int untilOutOfRefresh = 1;
g_ScreenIsLocked = 0;
if (g_ScreenWasLocked || untilOutOfRefresh) { if (g_ScreenWasLocked || untilOutOfRefresh) {
g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight);
g_system->updateScreen(); g_system->updateScreen();
} }
g_ScreenWasLocked = 0; g_ScreenWasLocked = 0;
WSDL_ProcessInput(); WSDL_ProcessInput(0);
for (uint32 now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) uint32 now;
for (now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() )
g_system->delayMillis(g_LastWaitTOFTicks - now + 17); g_system->delayMillis(g_LastWaitTOFTicks - now + 17);
g_LastWaitTOFTicks = now; g_LastWaitTOFTicks = now;
} }
static char curvgapal[256 * 3]; void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) {
g_system->getPaletteManager()->setPalette(buf, first, numreg);
if (slow)
waitTOF();
}
static byte curvgapal[256 * 3];
/*****************************************************************************/ /*****************************************************************************/
/* Writes any number of the 256 color registers. */ /* Writes any number of the 256 color registers. */
@ -126,57 +140,41 @@ static char curvgapal[256 * 3];
/* The length of the buffer is 3 times the number of registers */ /* The length of the buffer is 3 times the number of registers */
/* selected. */ /* selected. */
/*****************************************************************************/ /*****************************************************************************/
void writeColorRegs(char *buf, void writeColorRegs(byte *buf, uint16 first, uint16 numreg) {
uint16 first, WSDL_SetColors(buf, first, numreg, 0);
uint16 numreg) {
warning("STUB: writeColorRegs");
//WSDL_SetColors(buf, first, numreg, 0);
memcpy(&(curvgapal[first * 3]), buf, numreg * 3); memcpy(&(curvgapal[first * 3]), buf, numreg * 3);
} }
void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) {
WSDL_SetColors(buf, first, numreg, 1);
void writeColorRegsSmooth(char *buf,
uint16 first,
uint16 numreg) {
warning("STUB: writeColorRegsSmooth");
//WSDL_SetColors(buf, first, numreg, 1);
memcpy(&(curvgapal[first * 3]), buf, numreg * 3); memcpy(&(curvgapal[first * 3]), buf, numreg * 3);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ /* Sets one of the 256 (0..255) color registers. buf is a char pointer, */
/* the first character in the string is the red value, then green, then */ /* the first character in the string is the red value, then green, then */
/* blue. Each color value is a 6 bit value. */ /* blue. Each color value is a 6 bit value. */
/*****************************************************************************/ /*****************************************************************************/
void writeColorReg(char *buf, void writeColorReg(byte *buf, uint16 regnum) {
uint16 regnum) {
writeColorRegs(buf, regnum, 1); writeColorRegs(buf, regnum, 1);
} }
void VGASetPal(void *cmap, uint16 numcolors) {
void VGASetPal(void *cmap,
uint16 numcolors) {
if (memcmp(cmap, curvgapal, numcolors * 3) != 0) if (memcmp(cmap, curvgapal, numcolors * 3) != 0)
writeColorRegs((char *) cmap, 0, numcolors); writeColorRegs((byte *)cmap, 0, numcolors);
} }
byte *WSDL_LockVideo() { byte *WSDL_LockVideo() {
g_ScreenWasLocked = 1; g_ScreenWasLocked = 1;
g_ScreenIsLocked = 1;
return g_DisplayBuffer; return g_DisplayBuffer;
} }
void WSDL_UnlockVideo() { void WSDL_UnlockVideo() {
g_ScreenIsLocked = 0; }
void WSDL_IgnoreUpdateDisplay(int state) {
g_IgnoreUpdateDisplay = state;
} }
void WSDL_UpdateScreen() { void WSDL_UpdateScreen() {
@ -195,14 +193,14 @@ void WSDL_UpdateScreen() {
/* Returns the base address of the current VGA display. */ /* Returns the base address of the current VGA display. */
/*****************************************************************************/ /*****************************************************************************/
byte *getVGABaseAddr(void) { byte *getVGABaseAddr(void) {
if (VGABASEADDRESS != 1) if (VGABASEADDRESS)
return (byte *)VGABASEADDRESS; return VGABASEADDRESS;
return WSDL_LockVideo(); return WSDL_LockVideo();
} }
void ungetVGABaseAddr() { void ungetVGABaseAddr() {
if (VGABASEADDRESS == 1) if (!VGABASEADDRESS)
WSDL_UnlockVideo(); WSDL_UnlockVideo();
} }
@ -213,15 +211,10 @@ void getMode(uint16 *Mode) {
// Only one mode in SDL. // Only one mode in SDL.
} }
/*****************************************************************************/ /*****************************************************************************/
/* Draws an image to the screen. */ /* Draws an image to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void drawImage(struct Image *Im, void drawImage(struct Image *Im, uint16 x, uint16 y) {
uint16 x,
uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -337,9 +330,7 @@ void drawImage(struct Image *Im,
/*****************************************************************************/ /*****************************************************************************/
/* Draws an image to the screen. */ /* Draws an image to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void drawMaskImage(struct Image *Im, void drawMaskImage(struct Image *Im, uint16 x, uint16 y) {
uint16 x,
uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -469,9 +460,7 @@ void drawMaskImage(struct Image *Im,
/*****************************************************************************/ /*****************************************************************************/
/* Reads an image from the screen. */ /* Reads an image from the screen. */
/*****************************************************************************/ /*****************************************************************************/
void readScreenImage(struct Image *Im, void readScreenImage(struct Image *Im, uint16 x, uint16 y) {
uint16 x,
uint16 y) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int sx, sy, dx, dy, w, h; int sx, sy, dx, dy, w, h;
@ -588,14 +577,8 @@ void readScreenImage(struct Image *Im,
/* Blits a piece of one image to another. */ /* Blits a piece of one image to another. */
/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */
/*****************************************************************************/ /*****************************************************************************/
void bltBitMap(struct Image *ImSource, void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest,
uint16 xs, uint16 xd, uint16 yd, uint16 width, uint16 height) {
uint16 ys,
struct Image *ImDest,
uint16 xd,
uint16 yd,
uint16 width,
uint16 height) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
// I think the old code assumed that the source image data was valid for the given box. // I think the old code assumed that the source image data was valid for the given box.
// I will proceed on that assumption. // I will proceed on that assumption.
@ -727,11 +710,7 @@ byte *TempScrollData;
/* The TempScrollData variable must be initialized to some memory, or this */ /* The TempScrollData variable must be initialized to some memory, or this */
/* function will fail. */ /* function will fail. */
/*****************************************************************************/ /*****************************************************************************/
void scrollDisplayX(int16 dx, void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
uint16 x1,
uint16 y1,
uint16 x2,
uint16 y2) {
struct Image Im; struct Image Im;
uint16 temp; uint16 temp;
@ -777,11 +756,7 @@ void scrollDisplayX(int16 dx,
/*****************************************************************************/ /*****************************************************************************/
/* Scrolls the display in the y direction by blitting. */ /* Scrolls the display in the y direction by blitting. */
/*****************************************************************************/ /*****************************************************************************/
void scrollDisplayY(int16 dy, void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
uint16 x1,
uint16 y1,
uint16 x2,
uint16 y2) {
struct Image Im; struct Image Im;
uint16 temp; uint16 temp;
@ -837,10 +812,7 @@ void setAPen(uint16 pennum) {
/*****************************************************************************/ /*****************************************************************************/
/* Fills in a rectangle. */ /* Fills in a rectangle. */
/*****************************************************************************/ /*****************************************************************************/
void rectFill(uint16 x1, void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
uint16 y1,
uint16 x2,
uint16 y2) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int dx, dy, w, h; int dx, dy, w, h;
@ -952,9 +924,7 @@ void rectFill(uint16 x1,
/*****************************************************************************/ /*****************************************************************************/
/* Draws a horizontal line. */ /* Draws a horizontal line. */
/*****************************************************************************/ /*****************************************************************************/
void drawVLine(uint16 x, void drawVLine(uint16 x, uint16 y1, uint16 y2) {
uint16 y1,
uint16 y2) {
rectFill(x, y1, x, y2); rectFill(x, y1, x, y2);
} }
@ -964,9 +934,7 @@ void drawVLine(uint16 x,
/*****************************************************************************/ /*****************************************************************************/
/* Draws a vertical line. */ /* Draws a vertical line. */
/*****************************************************************************/ /*****************************************************************************/
void drawHLine(uint16 x1, void drawHLine(uint16 x1, uint16 y, uint16 x2) {
uint16 y,
uint16 x2) {
rectFill(x1, y, x2, y); rectFill(x1, y, x2, y);
} }
@ -976,11 +944,7 @@ void drawHLine(uint16 x1,
/*****************************************************************************/ /*****************************************************************************/
/* Ghoasts a region on the screen using the desired pen color. */ /* Ghoasts a region on the screen using the desired pen color. */
/*****************************************************************************/ /*****************************************************************************/
void ghoastRect(uint16 pencolor, void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
uint16 x1,
uint16 y1,
uint16 x2,
uint16 y2) {
#if !defined(DOSCODE) #if !defined(DOSCODE)
int dx, dy, w, h; int dx, dy, w, h;

View file

@ -63,11 +63,11 @@ byte *getVGABaseAddr(void);
void ungetVGABaseAddr(); void ungetVGABaseAddr();
#endif #endif
void writeColorReg(char *buf, uint16 regnum); void writeColorReg(byte *buf, uint16 regnum);
void writeColorRegs(char *buf, uint16 first, uint16 numreg); void writeColorRegs(byte *buf, uint16 first, uint16 numreg);
void writeColorRegsSmooth(char *buf, uint16 first, uint16 numreg); void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg);
void VGASetPal(void *cmap, uint16 numcolors); void VGASetPal(void *cmap, uint16 numcolors);
@ -97,6 +97,8 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
void WSDL_UpdateScreen(); void WSDL_UpdateScreen();
void WSDL_IgnoreUpdateDisplay(int state);
} // End of namespace Lab } // End of namespace Lab
#endif /* LAB_VGA_H */ #endif /* LAB_VGA_H */