This commit is contained in:
twinaphex 2015-03-26 12:33:55 +01:00
parent 1b772464ba
commit 25b2b776cf
6 changed files with 3084 additions and 3226 deletions

1130
id_sd.c

File diff suppressed because it is too large Load Diff

854
id_us_1.c

File diff suppressed because it is too large Load Diff

11
id_vl.c
View File

@ -113,7 +113,8 @@ void VL_SetVGAPlaneMode (void)
curPitch = bufferPitch;
scaleFactor = screenWidth/320;
if(screenHeight/200 < scaleFactor) scaleFactor = screenHeight/200;
if(screenHeight/200 < scaleFactor)
scaleFactor = screenHeight/200;
pixelangle = (short *) malloc(screenWidth * sizeof(short));
@ -515,10 +516,8 @@ void VL_MemToLatch(byte *source, int width, int height,
for(ysrc = 0; ysrc < height; ysrc++)
{
for(xsrc = 0; xsrc < width; xsrc++)
{
dest[ysrc * pitch + xsrc] = source[(ysrc * (width >> 2) + (xsrc >> 2))
+ (xsrc & 3) * (width >> 2) * height];
}
}
VL_UnlockSurface(destSurface);
}
@ -556,9 +555,7 @@ void VL_MemToScreenScaledCoord (byte *source, int width, int height, int destx,
for(m=0; m<scaleFactor; m++)
{
for(n=0; n<scaleFactor; n++)
{
vbuf[(scj+m+desty)*curPitch+sci+n+destx] = col;
}
}
}
}
@ -599,9 +596,7 @@ void VL_MemToScreenScaledCoord2 (byte *source, int origwidth, int origheight, in
for(m=0; m<scaleFactor; m++)
{
for(n=0; n<scaleFactor; n++)
{
vbuf[(scj+m+desty)*curPitch+sci+n+destx] = col;
}
}
}
}
@ -644,9 +639,7 @@ void VL_LatchToScreenScaledCoord(SDL_Surface *source, int xsrc, int ysrc,
for(m=0; m<scaleFactor; m++)
{
for(n=0; n<scaleFactor; n++)
{
vbuf[(scydest+scj+m)*curPitch+scxdest+sci+n] = col;
}
}
}
}

422
wl_act1.c
View File

@ -140,51 +140,51 @@ void InitStaticList (void)
void SpawnStatic (int tilex, int tiley, int type)
{
laststatobj->shapenum = statinfo[type].picnum;
laststatobj->tilex = tilex;
laststatobj->tiley = tiley;
laststatobj->visspot = &spotvis[tilex][tiley];
laststatobj->shapenum = statinfo[type].picnum;
laststatobj->tilex = tilex;
laststatobj->tiley = tiley;
laststatobj->visspot = &spotvis[tilex][tiley];
switch (statinfo[type].type)
{
case block:
actorat[tilex][tiley] = (objtype *) 64; // consider it a blocking tile
case none:
laststatobj->flags = 0;
break;
switch (statinfo[type].type)
{
case block:
actorat[tilex][tiley] = (objtype *) 64; // consider it a blocking tile
case none:
laststatobj->flags = 0;
break;
case bo_cross:
case bo_chalice:
case bo_bible:
case bo_crown:
case bo_fullheal:
if (!loadedgame)
gamestate.treasuretotal++;
case bo_cross:
case bo_chalice:
case bo_bible:
case bo_crown:
case bo_fullheal:
if (!loadedgame)
gamestate.treasuretotal++;
case bo_firstaid:
case bo_key1:
case bo_key2:
case bo_key3:
case bo_key4:
case bo_clip:
case bo_25clip:
case bo_machinegun:
case bo_chaingun:
case bo_food:
case bo_alpo:
case bo_gibs:
case bo_spear:
laststatobj->flags = FL_BONUS;
laststatobj->itemnumber = statinfo[type].type;
break;
}
case bo_firstaid:
case bo_key1:
case bo_key2:
case bo_key3:
case bo_key4:
case bo_clip:
case bo_25clip:
case bo_machinegun:
case bo_chaingun:
case bo_food:
case bo_alpo:
case bo_gibs:
case bo_spear:
laststatobj->flags = FL_BONUS;
laststatobj->itemnumber = statinfo[type].type;
break;
}
laststatobj->flags |= statinfo[type].specialFlags;
laststatobj->flags |= statinfo[type].specialFlags;
laststatobj++;
laststatobj++;
if (laststatobj == &statobjlist[MAXSTATS])
Quit ("Too many static objects!\n");
if (laststatobj == &statobjlist[MAXSTATS])
Quit ("Too many static objects!\n");
}
@ -202,45 +202,40 @@ void SpawnStatic (int tilex, int tiley, int type)
void PlaceItemType (int itemtype, int tilex, int tiley)
{
int type;
statobj_t *spot;
int type;
statobj_t *spot;
//
// find the item number
//
for (type=0; ; type++)
{
if (statinfo[type].picnum == -1) // end of list
Quit ("PlaceItemType: couldn't find type!");
if (statinfo[type].type == itemtype)
break;
}
/* find the item number */
for (type=0; ; type++)
{
if (statinfo[type].picnum == -1) // end of list
Quit ("PlaceItemType: couldn't find type!");
if (statinfo[type].type == itemtype)
break;
}
//
// find a spot in statobjlist to put it in
//
for (spot=&statobjlist[0]; ; spot++)
{
if (spot==laststatobj)
{
if (spot == &statobjlist[MAXSTATS])
return; // no free spots
laststatobj++; // space at end
break;
}
/* find a spot in statobjlist to put it in */
for (spot=&statobjlist[0]; ; spot++)
{
if (spot==laststatobj)
{
if (spot == &statobjlist[MAXSTATS])
return; // no free spots
laststatobj++; // space at end
break;
}
if (spot->shapenum == -1) // -1 is a free spot
break;
}
//
// place it
//
spot->shapenum = statinfo[type].picnum;
spot->tilex = tilex;
spot->tiley = tiley;
spot->visspot = &spotvis[tilex][tiley];
spot->flags = FL_BONUS | statinfo[type].specialFlags;
spot->itemnumber = statinfo[type].type;
if (spot->shapenum == -1) // -1 is a free spot
break;
}
/* place it */
spot->shapenum = statinfo[type].picnum;
spot->tilex = tilex;
spot->tiley = tiley;
spot->visspot = &spotvis[tilex][tiley];
spot->flags = FL_BONUS | statinfo[type].specialFlags;
spot->itemnumber = statinfo[type].type;
}
@ -368,10 +363,8 @@ void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
actorat[tilex][tiley] = (objtype *)(uintptr_t)(doornum | 0x80); // consider it a solid wall
//
// make the door tile a special tile, and mark the adjacent tiles
// for door sides
//
tilemap[tilex][tiley] = doornum | 0x80;
map = mapsegs[0] + (tiley<<mapshift) +tilex;
if (vertical)
@ -563,9 +556,7 @@ void DoorOpening (int door)
position = doorposition[door];
if (!position)
{
//
// door is just starting to open, so connect the areas
//
map = mapsegs[0] + (doorobjlist[door].tiley<<mapshift)
+doorobjlist[door].tilex;
@ -595,15 +586,11 @@ void DoorOpening (int door)
}
}
//
// slide the door by an adaptive amount
//
position += tics<<10;
if (position >= 0xffff)
{
//
// door is all the way open
//
position = 0xffff;
doorobjlist[door].ticcount = 0;
doorobjlist[door].action = dr_open;
@ -624,62 +611,58 @@ void DoorOpening (int door)
void DoorClosing (int door)
{
unsigned area1,area2;
word *map;
int32_t position;
int tilex,tiley;
unsigned area1,area2;
word *map;
int32_t position;
int tilex,tiley;
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
if ( ((int)(uintptr_t)actorat[tilex][tiley] != (door | 0x80))
|| (player->tilex == tilex && player->tiley == tiley) )
{ // something got inside the door
OpenDoor (door);
return;
};
if ( ((int)(uintptr_t)actorat[tilex][tiley] != (door | 0x80))
|| (player->tilex == tilex && player->tiley == tiley) )
{ // something got inside the door
OpenDoor (door);
return;
};
position = doorposition[door];
position = doorposition[door];
//
// slide the door by an adaptive amount
//
position -= tics<<10;
if (position <= 0)
{
//
// door is closed all the way, so disconnect the areas
//
position = 0;
// slide the door by an adaptive amount
position -= tics<<10;
if (position <= 0)
{
// door is closed all the way, so disconnect the areas
position = 0;
doorobjlist[door].action = dr_closed;
doorobjlist[door].action = dr_closed;
map = mapsegs[0] + (doorobjlist[door].tiley<<mapshift) + doorobjlist[door].tilex;
map = mapsegs[0] + (doorobjlist[door].tiley<<mapshift) + doorobjlist[door].tilex;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
if (area1 < NUMAREAS && area2 < NUMAREAS)
{
areaconnect[area1][area2]--;
areaconnect[area2][area1]--;
if (area1 < NUMAREAS && area2 < NUMAREAS)
{
areaconnect[area1][area2]--;
areaconnect[area2][area1]--;
if (player->areanumber < NUMAREAS)
ConnectAreas ();
}
}
if (player->areanumber < NUMAREAS)
ConnectAreas ();
}
}
doorposition[door] = (word) position;
doorposition[door] = (word) position;
}
@ -697,28 +680,28 @@ void DoorClosing (int door)
void MoveDoors (void)
{
int door;
int door;
if (gamestate.victoryflag) // don't move door during victory sequence
return;
if (gamestate.victoryflag) // don't move door during victory sequence
return;
for (door = 0; door < doornum; door++)
{
switch (doorobjlist[door].action)
{
case dr_open:
DoorOpen (door);
break;
for (door = 0; door < doornum; door++)
{
switch (doorobjlist[door].action)
{
case dr_open:
DoorOpen (door);
break;
case dr_opening:
DoorOpening(door);
break;
case dr_opening:
DoorOpening(door);
break;
case dr_closing:
DoorClosing(door);
break;
}
}
case dr_closing:
DoorClosing(door);
break;
}
}
}
@ -746,38 +729,38 @@ int dirs[4][2]={{0,-1},{1,0},{0,1},{-1,0}};
void PushWall (int checkx, int checky, int dir)
{
int oldtile, dx, dy;
int oldtile, dx, dy;
if (pwallstate)
return;
if (pwallstate)
return;
oldtile = tilemap[checkx][checky];
if (!oldtile)
return;
oldtile = tilemap[checkx][checky];
if (!oldtile)
return;
dx = dirs[dir][0];
dy = dirs[dir][1];
dx = dirs[dir][0];
dy = dirs[dir][1];
if (actorat[checkx+dx][checky+dy])
{
SD_PlaySound (NOWAYSND);
return;
}
actorat[checkx+dx][checky+dy] = (objtype *)(uintptr_t) (tilemap[checkx+dx][checky+dy] = oldtile);
if (actorat[checkx+dx][checky+dy])
{
SD_PlaySound (NOWAYSND);
return;
}
actorat[checkx+dx][checky+dy] = (objtype *)(uintptr_t) (tilemap[checkx+dx][checky+dy] = oldtile);
gamestate.secretcount++;
pwallx = checkx;
pwally = checky;
pwalldir = dir;
pwallstate = 1;
pwallpos = 0;
pwalltile = tilemap[pwallx][pwally];
tilemap[pwallx][pwally] = 64;
tilemap[pwallx+dx][pwally+dy] = 64;
*(mapsegs[1]+(pwally<<mapshift)+pwallx) = 0; // remove P tile info
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = *(mapsegs[0]+(player->tiley<<mapshift)+player->tilex); // set correct floorcode (BrotherTank's fix)
gamestate.secretcount++;
pwallx = checkx;
pwally = checky;
pwalldir = dir;
pwallstate = 1;
pwallpos = 0;
pwalltile = tilemap[pwallx][pwally];
tilemap[pwallx][pwally] = 64;
tilemap[pwallx+dx][pwally+dy] = 64;
*(mapsegs[1]+(pwally<<mapshift)+pwallx) = 0; // remove P tile info
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = *(mapsegs[0]+(player->tiley<<mapshift)+player->tilex); // set correct floorcode (BrotherTank's fix)
SD_PlaySound (PUSHWALLSND);
SD_PlaySound (PUSHWALLSND);
}
@ -792,62 +775,57 @@ void PushWall (int checkx, int checky, int dir)
void MovePWalls (void)
{
int oldblock,oldtile;
int oldblock,oldtile;
if (!pwallstate)
return;
if (!pwallstate)
return;
oldblock = pwallstate/128;
oldblock = pwallstate/128;
pwallstate += (word)tics;
pwallstate += (word)tics;
if (pwallstate/128 != oldblock)
{
// block crossed into a new block
oldtile = pwalltile;
if (pwallstate/128 != oldblock)
{
// block crossed into a new block
oldtile = pwalltile;
//
// the tile can now be walked into
//
tilemap[pwallx][pwally] = 0;
actorat[pwallx][pwally] = 0;
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = player->areanumber+AREATILE;
// the tile can now be walked into
tilemap[pwallx][pwally] = 0;
actorat[pwallx][pwally] = 0;
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = player->areanumber+AREATILE;
int dx=dirs[pwalldir][0], dy=dirs[pwalldir][1];
//
// see if it should be pushed farther
//
if (pwallstate>=256) // only move two tiles fix
{
//
// the block has been pushed two tiles
//
int dx=dirs[pwalldir][0], dy=dirs[pwalldir][1];
// see if it should be pushed farther
if (pwallstate>=256) // only move two tiles fix
{
// the block has been pushed two tiles
pwallstate = 0;
tilemap[pwallx+dx][pwally+dy] = oldtile;
return;
}
else
{
int xl,yl,xh,yh;
xl = (player->x-PLAYERSIZE) >> TILESHIFT;
yl = (player->y-PLAYERSIZE) >> TILESHIFT;
xh = (player->x+PLAYERSIZE) >> TILESHIFT;
yh = (player->y+PLAYERSIZE) >> TILESHIFT;
pwallx += dx;
pwally += dy;
if (actorat[pwallx+dx][pwally+dy]
|| xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh)
{
pwallstate = 0;
tilemap[pwallx+dx][pwally+dy] = oldtile;
tilemap[pwallx][pwally] = oldtile;
return;
}
else
{
int xl,yl,xh,yh;
xl = (player->x-PLAYERSIZE) >> TILESHIFT;
yl = (player->y-PLAYERSIZE) >> TILESHIFT;
xh = (player->x+PLAYERSIZE) >> TILESHIFT;
yh = (player->y+PLAYERSIZE) >> TILESHIFT;
}
actorat[pwallx+dx][pwally+dy] = (objtype *)(uintptr_t) (tilemap[pwallx+dx][pwally+dy] = oldtile);
tilemap[pwallx+dx][pwally+dy] = 64;
}
}
pwallx += dx;
pwally += dy;
if (actorat[pwallx+dx][pwally+dy]
|| xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh)
{
pwallstate = 0;
tilemap[pwallx][pwally] = oldtile;
return;
}
actorat[pwallx+dx][pwally+dy] = (objtype *)(uintptr_t) (tilemap[pwallx+dx][pwally+dy] = oldtile);
tilemap[pwallx+dx][pwally+dy] = 64;
}
}
pwallpos = (pwallstate/2)&63;
pwallpos = (pwallstate/2)&63;
}

2410
wl_act2.c

File diff suppressed because it is too large Load Diff

1483
wl_agent.c

File diff suppressed because it is too large Load Diff