shithub: duke3d

Download patch

ref: 6c8d7340dce68608d920aaf8656c65c046df2c9c
parent: 6f1f7a5eb2dd386bd17227c348e5d39b4ad71107
parent: 6744969feaf43ea336c3cd98b774e80b6541a080
author: Fabien Sanglard <[email protected]>
date: Mon Dec 17 14:25:02 EST 2012

Merge branch 'master' of github.com:fabiensanglard/chocolate_duke3D

--- a/Engine/src/a.c
+++ b/Engine/src/a.c
@@ -244,14 +244,6 @@
     return vplce;
 } 
 
-
-static uint8_t  transmach3_al = 32;
-void setuptvlineasm(int32_t i1)
-{
-    transmach3_al = (i1 & 0x1f);
-}
-
-
 static int transrev = 0;
 int32_t tvlineasm1(int32_t i1, int32_t i2, int32_t numPixels, int32_t i4, int32_t i5, int32_t _dest)
 {
@@ -258,11 +250,13 @@
 	uint8_t  *source = (uint8_t  *)i5;
 	uint8_t  *dest = (uint8_t  *)_dest;
 
+    uint8_t shiftValue = (globalshiftval & 0x1f);
+    
 	numPixels++;
 	while (numPixels)
 	{
 		uint32_t temp = i4;
-		temp >>= transmach3_al;
+		temp >>= shiftValue;
 		temp = source[temp];
 
 	    //255 is the index for transparent color index. Skip drawing this pixel. 
--- a/Engine/src/a.h
+++ b/Engine/src/a.h
@@ -19,7 +19,8 @@
 #endif
     
 extern uint8_t  *globalpalwritten;
-
+extern int16_t  globalshiftval;
+    
 void sethlinesizes(int32_t,int32_t,int32_t);
 
 
@@ -34,7 +35,7 @@
 void fixtransluscence(uint8_t*);
 int32_t prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 int32_t vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-void setuptvlineasm(int32_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);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -182,9 +182,9 @@
 //FCS: (down-most pixel +1 on column x that can still be drawn to)
 short dmost[MAXXDIM+1];
 
-static short bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
+static int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
 short uplc[MAXXDIM+1], dplc[MAXXDIM+1];
-static short uwall[MAXXDIM+1], dwall[MAXXDIM+1];
+static int16_t uwall[MAXXDIM+1], dwall[MAXXDIM+1];
 static int32_t swplc[MAXXDIM+1], lplc[MAXXDIM+1];
 static int32_t swall[MAXXDIM+1], lwall[MAXXDIM+4];
 int32_t xdimen = -1, xdimenrecip, halfxdimen, xdimenscale, xdimscale;
@@ -198,7 +198,7 @@
 int32_t *horizlookup=0, *horizlookup2=0, horizycent;
 
 int32_t globalposx, globalposy, globalposz, globalhoriz;
-short globalang, globalcursectnum;
+int16_t globalang, globalcursectnum;
 int32_t globalpal, cosglobalang, singlobalang;
 int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
 uint8_t  *globalpalwritten;
@@ -212,7 +212,7 @@
 int32_t vplce[4], vince[4], palookupoffse[4], bufplce[4];
 uint8_t  globalxshift, globalyshift;
 int32_t globalxpanning, globalypanning, globalshade;
-short globalpicnum, globalshiftval;
+int16_t globalpicnum, globalshiftval;
 int32_t globalzd, globalbufplc, globalyscale, globalorientation;
 int32_t globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx;
 int32_t globalx, globaly, globalz;
@@ -228,8 +228,8 @@
 static uint8_t  tablesloaded = 0;
 int32_t pageoffset, ydim16, qsetmode = 0;
 int32_t startposx, startposy, startposz;
-short startang, startsectnum;
-short pointhighlight, linehighlight, highlightcnt;
+int16_t startang, startsectnum;
+int16_t pointhighlight, linehighlight, highlightcnt;
 static int32_t lastx[MAXYDIM];
 uint8_t  *transluc = NULL, paletteloaded = 0;
 
@@ -241,7 +241,7 @@
 static uint8_t  coldist[8] = {0,1,2,3,4,3,2,1};
 static int32_t colscan[27];
 
-static short clipnum, hitwalls[4];
+static int16_t clipnum, hitwalls[4];
 int32_t hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1;
 
 typedef struct {
@@ -3111,8 +3111,6 @@
     if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
 
     if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
-
-    setuptvlineasm(globalshiftval);
 
     x = x1;
     while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++;
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -84,7 +84,7 @@
 	for(i=numinterpolations-1;i>=0;i--) *curipos[i] = bakipos[i];
 }
 
-int32_t ceilingspace(short sectnum)
+int32_t ceilingspace(int16_t sectnum)
 {
     if( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 )
     {
@@ -98,7 +98,7 @@
     return 0;
 }
 
-int32_t floorspace(short sectnum)
+int32_t floorspace(int16_t sectnum)
 {
     if( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 )
     {
@@ -112,7 +112,7 @@
     return 0;
 }
 
-void addammo( short weapon,struct player_struct *p,short amount)
+void addammo( int16_t weapon,struct player_struct *p,int16_t amount)
 {
    p->ammo_amount[weapon] += amount;
 
@@ -120,7 +120,7 @@
         p->ammo_amount[weapon] = max_ammo_amount[weapon];
 }
 
-void addweapon( struct player_struct *p,short weapon)
+void addweapon( struct player_struct *p,int16_t weapon)
 {
 	int added_new_weapon = false;