shithub: duke3d

Download patch

ref: 2a0d941df09bab8257d799d1133c0eab3ece3616
parent: 553f9ff53af6053926ccd002ddd43001e31f4c14
author: Fabien Sanglard <[email protected]>
date: Wed Dec 19 18:12:25 EST 2012

frampleace,frameoffset are now pointer instead of int32_t

--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -312,7 +312,11 @@
 char  **_argv = NULL;
 
     /* !!! move these elsewhere? */
-int32_t xres, yres, bytesperline, frameplace, frameoffset, imageSize, maxpages;
+int32_t xres, yres, bytesperline, imageSize, maxpages;
+uint8_t* frameplace;
+
+//The frambuffer address
+uint8_t* frameoffset;
 uint8_t  *screen, vesachecked;
 int32_t buffermode, origbuffermode, linearmode;
 uint8_t  permanentupdate = 0, vgacompatible;
@@ -511,7 +515,7 @@
 		// FIX_00083: Sporadic crash on fullscreen/window mode toggle
 		// frameoffset wasn't always updated fast enought. Build were using the old 
 		// pointer of frameoffset.  
-        frameoffset = frameplace = (int32_t) ( ((Uint8 *) surface->pixels) );
+        frameoffset = frameplace = (uint8_t*)surface->pixels;
 
   	if (screen != NULL)
    	{
--- a/Engine/src/display.h
+++ b/Engine/src/display.h
@@ -24,8 +24,9 @@
 extern int32_t oxdimen, oviewingrange, oxyaspect;
 extern int32_t curbrightness;
 extern int32_t qsetmode;
-extern int32_t frameplace, pageoffset, ydim16;
-extern int32_t frameoffset;
+extern int32_t  pageoffset, ydim16;
+extern uint8_t* frameplace;
+extern uint8_t* frameoffset;
 extern uint8_t  textfont[1024], smalltextfont[1024];
 extern uint8_t  pow2char[8];
 extern int32_t stereomode, visualpage, activepage, whiteband, blackband;
--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -386,15 +386,14 @@
 
 
 static uint8_t  machmv;
-int32_t mvlineasm1(int32_t vince, int32_t palookupoffse, int32_t i3, int32_t vplce, int32_t bufplce, int32_t i6)
+int32_t mvlineasm1(int32_t vince, int32_t palookupoffse, int32_t i3, int32_t vplce, uint8_t* texture, uint8_t  *dest)
 {
     uint32_t temp;
-    uint8_t  *dest = (uint8_t  *)i6;
 
     for(;i3>=0;i3--)
     {
 		temp = ((uint32_t)vplce) >> machmv;
-	    temp = ((uint8_t  *)bufplce)[temp];
+	    temp = texture[temp];
 
 	    if (temp != 255) 
 		{
@@ -427,7 +426,9 @@
         
         uint32_t index = (framebuffer + ylookup[columnIndex]);
         uint8_t  *dest= (uint8_t *)(-ylookup[columnIndex]);
+        //uint8_t  *dest= (uint8_t *)framebuffer;
         
+        uint32_t index = 0;
         do {
             for (i = 0; i < 4; i++)
             {
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -41,12 +41,12 @@
 void setBytesPerLine(int32_t);
 void fixtransluscence(uint8_t*);
 int32_t prevlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t  *,uint8_t  *);
-int32_t vlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t  *,uint8_t  *);
+int32_t vlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t  *,uint8_t*);
 
 int32_t tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 void setuptvlineasm2(int32_t,int32_t,int32_t);
 void tvlineasm2(uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t);
-int32_t mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
+int32_t mvlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t* texture,uint8_t* dest);
 void setupvlineasm(int32_t);
 void vlineasm4(int32_t,int32_t);
 void setupmvlineasm(int32_t);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -1303,7 +1303,7 @@
     while ((umost[x] > dmost[x]) && (x <= x2))
         x++;
 
-    for(; (x<=x2)&&((x+frameoffset)&3); x++)
+    for(; (x<=x2)&&((x+frameoffset-(uint8_t*)NULL)&3); x++)
     {
         y1ve[0] = max(uwal[x],umost[x]);
         y2ve[0] = min(dwal[x],dmost[x]);
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -587,7 +587,7 @@
 
 extern int current_menu;
 extern int32_t tempwallptr,animatecnt;
-extern int32_t lockclock,frameplace;
+extern int32_t lockclock;
 extern uint8_t  display_mirror,rtsplaying;
 
 extern int32_t movefifoend[MAXPLAYERS];
@@ -605,7 +605,7 @@
 
 #define NUMKEYS 19
 
-extern int32_t frameplace, chainplace, chainnumpages;
+extern int32_t chainplace, chainnumpages;
 extern volatile int32_t checksume;
 
 #include "funct.h"