ref: bef0add179564dcba03c8f66b648a7bf07400295
parent: ac03e8e1db6a30e31274f6c9de8bf3e2f6c1bc28
author: Rohit Nirmal <rohitnirmal9@gmail.com>
date: Sun Dec 14 17:21:30 EST 2014
64-bit: Fix initial segfaults. Game starts up and plays some of starting demo.
--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -152,7 +152,7 @@
//FCS: ????
-void rmhlineasm4(int32_t i1, int32_t shade, int32_t colorIndex, int32_t i4, int32_t i5, int32_t dest)
+void rmhlineasm4(int32_t i1, intptr_t shade, int32_t colorIndex, int32_t i4, int32_t i5, int32_t dest)
{
uint32_t ebp = dest - i1;
uint32_t rmach6b = ebp-1;
@@ -305,13 +305,13 @@
} /* */
-void tvlineasm2(uint32_t i1, uint32_t i2, uint32_t i3, uint32_t i4, uint32_t i5, uint32_t i6)
+void tvlineasm2(uint32_t i1, uint32_t i2, uintptr_t i3, uintptr_t i4, uint32_t i5, uintptr_t i6)
{
uint32_t ebp = i1;
uint32_t tran2inca = i2;
uint32_t tran2incb = asm1;
- uint32_t tran2bufa = i3;
- uint32_t tran2bufb = i4;
+ uintptr_t tran2bufa = i3;
+ uintptr_t tran2bufb = i4;
uint32_t tran2edi = asm2;
uint32_t tran2edi1 = asm2 + 1;
@@ -400,7 +400,7 @@
}
//FCS This is used to fill the inside of a wall (so it draws VERTICAL column, always).
-void vlineasm4(int32_t columnIndex, int32_t framebuffer)
+void vlineasm4(int32_t columnIndex, intptr_t framebuffer)
{
if (!RENDER_DRAW_WALL_INSIDE)
@@ -410,7 +410,7 @@
int i;
uint32_t temp;
- uint32_t index = (framebuffer + ylookup[columnIndex]);
+ uintptr_t index = (framebuffer + ylookup[columnIndex]);
uint8_t *dest= (uint8_t *)(-ylookup[columnIndex]);
//uint8_t *dest= (uint8_t *)framebuffer;
@@ -440,11 +440,11 @@
}
-void mvlineasm4(int32_t column, int32_t framebufferOffset)
+void mvlineasm4(int32_t column, intptr_t framebufferOffset)
{
int i;
uint32_t temp;
- uint32_t index = (framebufferOffset + ylookup[column]);
+ uintptr_t index = (framebufferOffset + ylookup[column]);
uint8_t *dest = (uint8_t *)(-ylookup[column]);
do {
@@ -821,7 +821,7 @@
-static int32_t slopemach_ebx;
+static intptr_t slopemach_ebx;
static int32_t slopemach_ecx;
static int32_t slopemach_edx;
static uint8_t slopemach_ah1;
@@ -828,7 +828,7 @@
static uint8_t slopemach_ah2;
static float asm2_f;
typedef union { unsigned int i; float f; } bitwisef2i;
-void setupslopevlin(int32_t i1, int32_t i2, int32_t i3)
+void setupslopevlin(int32_t i1, intptr_t i2, int32_t i3)
{
bitwisef2i c;
slopemach_ebx = i2;
@@ -848,7 +848,7 @@
#define high32(a) ((int)(((__int64)a&(__int64)0xffffffff00000000)>>32))
//FCS: Render RENDER_SLOPPED_CEILING_AND_FLOOR
-void slopevlin(int32_t i1, uint32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
+void slopevlin(intptr_t i1, uint32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
{
bitwisef2i c;
uint32_t ecx,eax,ebx,edx,esi,edi;
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -27,7 +27,7 @@
extern uint8_t *globalpalwritten;
extern int16_t globalshiftval;
extern int32_t vplce[4], vince[4];
-extern int32_t bufplce[4];
+extern intptr_t bufplce[4];
extern uint8_t* palookupoffse[4];
void sethlinesizes(int32_t,int32_t,uint8_t *);
@@ -37,7 +37,7 @@
void setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
void rhlineasm4(int32_t,uint8_t*,int32_t,uint32_t,uint32_t,int32_t);
void setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-void rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
+void rmhlineasm4(int32_t,intptr_t,int32_t,int32_t,int32_t,int32_t);
void setBytesPerLine(int32_t);
@@ -47,12 +47,12 @@
int32_t tvlineasm1(int32_t,uint8_t *,int32_t,int32_t,uint8_t *,uint8_t * dest);
void setuptvlineasm2(int32_t,int32_t,int32_t);
-void tvlineasm2(uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t);
+void tvlineasm2(uint32_t,uint32_t,uintptr_t,uintptr_t,uint32_t,uintptr_t);
int32_t mvlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t* texture,uint8_t* dest);
void setupvlineasm(int32_t);
-void vlineasm4(int32_t,int32_t);
+void vlineasm4(int32_t,intptr_t);
void setupmvlineasm(int32_t);
-void mvlineasm4(int32_t,int32_t);
+void mvlineasm4(int32_t,intptr_t);
void setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
void spritevline(int32_t,uint32_t,int32_t,uint32_t,uint8_t*,uint8_t*);
void msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
@@ -65,8 +65,8 @@
void thline(uint8_t*,int32_t,int32_t,int32_t,int32_t,uint8_t *);
void thlineskipmodify(int32_t,uint32_t,uint32_t,int32_t,int32_t,uint8_t *);
void tsethlineshift(int32_t,int32_t);
-void setupslopevlin(int32_t,int32_t,int32_t);
-void slopevlin(int32_t,uint32_t,int32_t,int32_t,int32_t,int32_t);
+void setupslopevlin(int32_t,intptr_t,int32_t);
+void slopevlin(intptr_t,uint32_t,int32_t,int32_t,int32_t,int32_t);
#define TRANS_NORMAL 0
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -190,11 +190,12 @@
int32_t xyaspect, viewingrangerecip;
-int32_t asm1, asm2, asm3, asm4;
+int32_t asm1, asm2, asm4;
+intptr_t asm3;
int32_t vplce[4], vince[4];
-int32_t bufplce[4];
+intptr_t bufplce[4];
uint8_t* palookupoffse[4];
@@ -1224,7 +1225,8 @@
int16_t *uwal, int16_t *dwal,
int32_t *swal, int32_t *lwal)
{
- int32_t i, x, xnice, ynice;
+ int32_t x, xnice, ynice;
+ intptr_t i;
uint8_t* fpalookup;
int32_t y1ve[4], y2ve[4], u4, d4, z, tileWidth, tsizy;
uint8_t bad;
@@ -1413,7 +1415,8 @@
short *uwal, short *dwal,
int32_t *swal, int32_t *lwal)
{
- int32_t i, x, startx, xnice, ynice;
+ int32_t x, startx, xnice, ynice;
+ intptr_t i;
uint8_t* fpalookup;
int32_t y1ve[4], y2ve[4], u4, d4, dax, z, tileWidth, tileHeight;
uint8_t* p;
@@ -3044,7 +3047,8 @@
static void transmaskvline(int32_t x)
{
- int32_t vplc, vinc, p, i, palookupoffs, bufplc;
+ int32_t vplc, vinc, p, i, palookupoffs;
+ intptr_t bufplc;
short y1v, y2v;
if ((x < 0) || (x >= xdimen)) return;