Main Page | Class List | Directories | File List | Class Members | File Members

mappyal.c File Reference

#include <stdio.h>
#include <string.h>
#include <allegro.h>

Include dependency graph for mappyal.c:

Go to the source code of this file.

Classes

struct  BLKSTR
struct  ANISTR

Defines

#define RB8BITTOPINK
#define MER_NONE   0
#define MER_OUTOFMEM   1
#define MER_MAPLOADERROR   2
#define MER_NOOPEN   3
#define MER_NOSCREEN   4
#define MER_NOACCELERATION   5
#define MER_CVBFAILED   6
#define MER_MAPTOONEW   7
#define AN_END   -1
#define AN_NONE   0
#define AN_LOOPF   1
#define AN_LOOPR   2
#define AN_ONCE   3
#define AN_ONCEH   4
#define AN_PPFF   5
#define AN_PPRR   6
#define AN_PPRF   7
#define AN_PPFR   8
#define AN_ONCES   9

Functions

int MapGenerateYLookup (void)
int MapGetXOffset (int xpix, int ypix)
int MapGetYOffset (int xpix, int ypix)
BLKSTRMapGetBlockInPixels (int x, int y)
BLKSTRMapGetBlock (int x, int y)
void MapSetBlockInPixels (int x, int y, int strvalue)
void MapSetBlock (int x, int y, int strvalue)
int MapChangeLayer (int newlyr)
int MapGetBlockID (int blid, int usernum)
int MapDecodeMAR (unsigned char *mrpt, int marlyr)
int MapLoadMAR (char *mname, int marlyr)
void MapInitAnims (void)
void MapUpdateAnims (void)
void Mapconv8to6pal (unsigned char *palpt)
void MapFreeMem (void)
void MapSetPal8 (void)
void MapCorrectColours (void)
void MapRestore (void)
int MapRelocate2 (void)
int MapRelocate (void)
int MapDecodeMPHD (unsigned char *mdatpt)
int MapDecodeCMAP (unsigned char *mdatpt)
int MapDecodeBKDT (unsigned char *mdatpt)
int MapDecodeANDT (unsigned char *mdatpt)
int MapDecodeAGFX (unsigned char *mdatpt)
int MapDecodeBGFX (unsigned char *mdatpt)
int MapDecodeNOVC (unsigned char *mdatpt)
int MapDecodeLayer (unsigned char *mdatpt, int lnum)
int MapDecodeNULL (unsigned char *mdatpt)
int MapRealDecode (PACKFILE *mfpt, unsigned char *mmpt, long int mpfilesize)
int MapRealLoad (char *mname)
int MapLoad (char *mapname)
int MapLoadVRAM (char *mapname)
int MapLoadABM (char *mapname)
int MapPreRealDecode (unsigned char *mapmempt)
int MapDecode (unsigned char *mapmempt)
int MapDecodeVRAM (unsigned char *mapmempt)
int MapDecodeABM (unsigned char *mapmempt)
BITMAP * MapMakeParallaxBitmap (BITMAP *sourcebm, int style)
void MapDrawParallax (BITMAP *mapdestpt, BITMAP *parbm, int mapxo, int mapyo, int mapx, int mapy, int mapw, int maph)
void MapDrawBG (BITMAP *mapdestpt, int mapxo, int mapyo, int mapx, int mapy, int mapw, int maph)
void MapDrawBGT (BITMAP *mapdestpt, int mapxo, int mapyo, int mapx, int mapy, int mapw, int maph)
void MapDrawFG (BITMAP *mapdestpt, int mapxo, int mapyo, int mapx, int mapy, int mapw, int maph, int mapfg)
void MapDrawRow (BITMAP *mapdestpt, int mapxo, int mapyo, int mapx, int mapy, int mapw, int maph, int maprw, void(*cellcall)(int cx, int cy, int dx, int dy))

Variables

int maperror
int mapgfxinbitmaps
short int mapwidth
short int mapheight
short int mapblockwidth
short int mapblockheight
short int mapdepth
short int mapblockstrsize
short int mapnumblockstr
short int mapnumblockgfx
PACKFILE * mapfilept
short int * mappt = NULL
short int ** maparraypt = NULL
char * mapcmappt = NULL
char * mapblockgfxpt = NULL
char * mapblockstrpt = NULL
ANISTRmapanimstrpt = NULL
int * mapanimseqpt = NULL
ANISTRmapanimstrendpt
RGB mapcmap6bit [256]
short int * mapmappt [8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
short int ** mapmaparraypt [8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
BITMAP ** abmTiles = NULL
int mapaltdepth
int maptype
int mapislsb
int mapclickmask
int mapblockgapx
int mapblockgapy
int mapblockstaggerx
int mapblockstaggery
int mapblocksinvidmem
int mapblocksinsysmem
char mapnovctext [80]


Define Documentation

#define AN_END   -1
 

Definition at line 28 of file mappyal.c.

#define AN_LOOPF   1
 

Definition at line 30 of file mappyal.c.

#define AN_LOOPR   2
 

Definition at line 31 of file mappyal.c.

#define AN_NONE   0
 

Definition at line 29 of file mappyal.c.

#define AN_ONCE   3
 

Definition at line 32 of file mappyal.c.

#define AN_ONCEH   4
 

Definition at line 33 of file mappyal.c.

#define AN_ONCES   9
 

Definition at line 38 of file mappyal.c.

#define AN_PPFF   5
 

Definition at line 34 of file mappyal.c.

#define AN_PPFR   8
 

Definition at line 37 of file mappyal.c.

#define AN_PPRF   7
 

Definition at line 36 of file mappyal.c.

#define AN_PPRR   6
 

Definition at line 35 of file mappyal.c.

#define MER_CVBFAILED   6
 

Definition at line 25 of file mappyal.c.

#define MER_MAPLOADERROR   2
 

Definition at line 21 of file mappyal.c.

#define MER_MAPTOONEW   7
 

Definition at line 26 of file mappyal.c.

Referenced by MapDecodeMPHD().

#define MER_NOACCELERATION   5
 

Definition at line 24 of file mappyal.c.

#define MER_NONE   0
 

Definition at line 19 of file mappyal.c.

#define MER_NOOPEN   3
 

Definition at line 22 of file mappyal.c.

#define MER_NOSCREEN   4
 

Definition at line 23 of file mappyal.c.

#define MER_OUTOFMEM   1
 

Definition at line 20 of file mappyal.c.

#define RB8BITTOPINK
 

Definition at line 16 of file mappyal.c.


Function Documentation

int MapChangeLayer int  newlyr  ) 
 

Definition at line 258 of file mappyal.c.

References maparraypt, mapmaparraypt, mapmappt, and mappt.

00259 {
00260   if (newlyr<0 || newlyr>7 || mapmappt[newlyr] == NULL) return -1;
00261   mappt = mapmappt[newlyr]; maparraypt = mapmaparraypt[newlyr];
00262   return newlyr;
00263 }

void Mapconv8to6pal unsigned char *  palpt  ) 
 

Definition at line 443 of file mappyal.c.

References mapcmap6bit.

Referenced by MapDecodeCMAP().

00444 {
00445   int i;
00446   for (i=0;i<256;i++)
00447     {
00448       mapcmap6bit[i].r=(*(palpt)>>2);
00449       mapcmap6bit[i].g=(*(palpt+1)>>2);
00450       mapcmap6bit[i].b=(*(palpt+2)>>2);
00451       palpt+=3;
00452     }
00453 }

void MapCorrectColours void   ) 
 

Definition at line 480 of file mappyal.c.

00481 {
00482   /* Remember, Intel stores shorts and longs the wrong way round!
00483    * ie. 0x12345678 will be 0x78563412
00484    */
00485   return;
00486 }

int MapDecode unsigned char *  mapmempt  ) 
 

Definition at line 1260 of file mappyal.c.

References mapgfxinbitmaps, and MapPreRealDecode().

01261 {
01262   mapgfxinbitmaps = 2;
01263   return MapPreRealDecode (mapmempt);
01264 }

Here is the call graph for this function:

int MapDecodeABM unsigned char *  mapmempt  ) 
 

Definition at line 1272 of file mappyal.c.

References mapgfxinbitmaps, and MapPreRealDecode().

01273 {
01274   mapgfxinbitmaps = 2;
01275   return MapPreRealDecode (mapmempt);
01276 }

Here is the call graph for this function:

int MapDecodeAGFX unsigned char *  mdatpt  ) 
 

Definition at line 992 of file mappyal.c.

References mapaltdepth, mapblockgfxpt, maperror, and MER_OUTOFMEM.

Referenced by MapRealDecode().

00993 {
00994   if (bitmap_color_depth (screen) > 8) return 0;
00995   if (mapblockgfxpt != NULL) free (mapblockgfxpt);
00996   mapblockgfxpt = malloc (MapGetchksz (mdatpt+4));
00997   if (mapblockgfxpt==NULL) { maperror = MER_OUTOFMEM; return -1; }
00998   memcpy (mapblockgfxpt, mdatpt+8, MapGetchksz(mdatpt+4));
00999   mapaltdepth = 8;
01000   return 0;
01001 }

int MapDecodeANDT unsigned char *  mdatpt  ) 
 

Definition at line 943 of file mappyal.c.

References ANISTR::ancount, ANISTR::ancuroff, ANISTR::andelay, ANISTR::anendoff, ANISTR::anstartoff, ANISTR::antype, ANISTR::anuser, mapanimseqpt, mapblockstrsize, maperror, MapInitAnims(), maptype, and MER_OUTOFMEM.

Referenced by MapRealDecode().

00944 {
00945   int numani, i, ancksz;
00946   unsigned char * mdatendpt;
00947 
00948   mdatpt += 8;
00949   ancksz = MapGetchksz(mdatpt-4);
00950   mdatendpt = mdatpt+ancksz;
00951 
00952   numani = 0; while (1) {
00953     mdatendpt -= 16;
00954     numani++;
00955     if (*mdatendpt == 255) break;
00956   }
00957 
00958   mapanimseqpt = malloc (((mdatendpt-mdatpt)/4)*sizeof(int));
00959   if (mapanimseqpt == NULL) { maperror = MER_OUTOFMEM; return -1; }
00960   i = 0; while (mdatpt != mdatendpt) {
00961     mapanimseqpt[i] = MapGetlong (mdatpt);
00962     if (maptype == 0) mapanimseqpt[i] /= mapblockstrsize;
00963     mdatpt += 4; i++;
00964   }
00965 
00966   mapanimstrpt = malloc (numani*sizeof(ANISTR));
00967   if (mapanimstrpt == NULL) { maperror = MER_OUTOFMEM; return -1; }
00968   mapanimstrendpt = mapanimstrpt;
00969   mapanimstrendpt += numani;
00970 
00971   i = 0; while (i<numani) {
00972     mapanimstrpt[i].antype = mdatendpt[0];
00973     mapanimstrpt[i].andelay = mdatendpt[1];
00974     mapanimstrpt[i].ancount = mdatendpt[2];
00975     mapanimstrpt[i].anuser = mdatendpt[3];
00976     if (maptype == 0) {
00977       mapanimstrpt[i].ancuroff = (int) ((MapGetlong (mdatendpt+4)+ancksz)/4);
00978       mapanimstrpt[i].anstartoff = (int) ((MapGetlong (mdatendpt+8)+ancksz)/4);
00979       mapanimstrpt[i].anendoff = (int) ((MapGetlong (mdatendpt+12)+ancksz)/4);
00980     } else {
00981       mapanimstrpt[i].ancuroff = (int) MapGetlong (mdatendpt+4);
00982       mapanimstrpt[i].anstartoff = (int) MapGetlong (mdatendpt+8);
00983       mapanimstrpt[i].anendoff = (int) MapGetlong (mdatendpt+12);
00984     }
00985     mdatendpt += 16; i++;
00986   }
00987 
00988   MapInitAnims ();
00989   return 0;
00990 }

Here is the call graph for this function:

int MapDecodeBGFX unsigned char *  mdatpt  ) 
 

Definition at line 1003 of file mappyal.c.

References mapblockgfxpt, maperror, and MER_OUTOFMEM.

Referenced by MapRealDecode().

01004 {
01005   if (mapblockgfxpt != NULL) return 0;
01006   mapblockgfxpt = malloc (MapGetchksz (mdatpt+4));
01007   if (mapblockgfxpt==NULL) { maperror = MER_OUTOFMEM; return -1; }
01008   memcpy (mapblockgfxpt, mdatpt+8, MapGetchksz(mdatpt+4));
01009   return 0;
01010 }

int MapDecodeBKDT unsigned char *  mdatpt  ) 
 

Definition at line 900 of file mappyal.c.

References BLKSTR::bgoff, BLKSTR::bl, BLKSTR::br, BLKSTR::fgoff, BLKSTR::fgoff2, BLKSTR::fgoff3, mapblockheight, mapblockstrpt, mapblockstrsize, mapblockwidth, mapdepth, maperror, mapnumblockstr, maptype, MER_OUTOFMEM, BLKSTR::tl, BLKSTR::tr, BLKSTR::trigger, BLKSTR::unused1, BLKSTR::unused2, BLKSTR::unused3, BLKSTR::user1, BLKSTR::user2, BLKSTR::user3, BLKSTR::user4, BLKSTR::user5, BLKSTR::user6, and BLKSTR::user7.

Referenced by MapRealDecode().

00901 {
00902   int i, j;
00903   BLKSTR * myblkpt;
00904 
00905   mdatpt += 8;
00906   mapblockstrpt = malloc (mapnumblockstr*sizeof(BLKSTR));
00907   if (mapblockstrpt==NULL) { maperror = MER_OUTOFMEM; return -1; }
00908 
00909   myblkpt = (BLKSTR *) mapblockstrpt;
00910   j = MapGetchksz (mdatpt-4);
00911   i = 0; while (i < (mapnumblockstr*mapblockstrsize)) {
00912     myblkpt->bgoff = (int) MapGetlong (mdatpt+i);
00913     myblkpt->fgoff = (int) MapGetlong (mdatpt+i+4);
00914     myblkpt->fgoff2 = (int) MapGetlong (mdatpt+i+8);
00915     myblkpt->fgoff3 = (int) MapGetlong (mdatpt+i+12);
00916     if (maptype == 0) {
00917       myblkpt->bgoff /= (mapblockwidth*mapblockheight*((mapdepth+1)/8));
00918       myblkpt->fgoff /= (mapblockwidth*mapblockheight*((mapdepth+1)/8));
00919       myblkpt->fgoff2 /= (mapblockwidth*mapblockheight*((mapdepth+1)/8));
00920       myblkpt->fgoff3 /= (mapblockwidth*mapblockheight*((mapdepth+1)/8));
00921     }
00922     myblkpt->user1 = (unsigned int) MapGetlong (mdatpt+i+16);
00923     myblkpt->user2 = (unsigned int) MapGetlong (mdatpt+i+20);
00924     myblkpt->user3 = (unsigned short int) MapGetshort (mdatpt+i+24);
00925     myblkpt->user4 = (unsigned short int) MapGetshort (mdatpt+i+26);
00926     myblkpt->user5 = mdatpt[i+28];
00927     myblkpt->user6 = mdatpt[i+29];
00928     myblkpt->user7 = mdatpt[i+30];
00929     if (mdatpt[i+31]&0x80) myblkpt->unused3 = 1; else myblkpt->unused3 = 0;
00930     if (mdatpt[i+31]&0x40) myblkpt->unused2 = 1; else myblkpt->unused2 = 0;
00931     if (mdatpt[i+31]&0x20) myblkpt->unused1 = 1; else myblkpt->unused1 = 0;
00932     if (mdatpt[i+31]&0x10) myblkpt->trigger = 1; else myblkpt->trigger = 0;
00933     if (mdatpt[i+31]&0x08) myblkpt->br = 1; else myblkpt->br = 0;
00934     if (mdatpt[i+31]&0x04) myblkpt->bl = 1; else myblkpt->bl = 0;
00935     if (mdatpt[i+31]&0x02) myblkpt->tr = 1; else myblkpt->tr = 0;
00936     if (mdatpt[i+31]&0x01) myblkpt->tl = 1; else myblkpt->tl = 0;
00937     i += mapblockstrsize;
00938     myblkpt++;
00939   }
00940   return 0;
00941 }

int MapDecodeCMAP unsigned char *  mdatpt  ) 
 

Definition at line 890 of file mappyal.c.

References mapcmappt, Mapconv8to6pal(), maperror, and MER_OUTOFMEM.

Referenced by MapRealDecode().

00891 {
00892   mdatpt += 8;
00893   mapcmappt = (unsigned char *) malloc (MapGetchksz (mdatpt-4));
00894   if (mapcmappt==NULL) { maperror = MER_OUTOFMEM; return -1; }
00895   memcpy (mapcmappt, mdatpt, MapGetchksz (mdatpt-4));
00896   Mapconv8to6pal (mapcmappt);
00897   return 0;
00898 }

Here is the call graph for this function:

int MapDecodeLayer unsigned char *  mdatpt,
int  lnum
 

Definition at line 1019 of file mappyal.c.

References mapblockstrsize, maperror, mapheight, mapmappt, mappt, maptype, mapwidth, and MER_OUTOFMEM.

Referenced by MapRealDecode().

01020 {
01021   int i, j, k, l;
01022   short int * mymappt, * mymap2pt;
01023 
01024   mapmappt[lnum] = malloc (mapwidth*mapheight*sizeof(short int));
01025   if (mapmappt[lnum] == NULL) { maperror = MER_OUTOFMEM; return -1; }
01026 
01027   mdatpt += 8;
01028   mymappt = mapmappt[lnum];
01029   if (maptype == 0) {
01030     for (j=0;j<mapheight;j++) {
01031       for (i=0;i<mapwidth;i++) {
01032         *mymappt = (short int) MapGetshort (mdatpt);
01033         if (*mymappt >= 0) { *mymappt /= mapblockstrsize; }
01034         else { *mymappt /= 16; }
01035         mdatpt+=2; mymappt++;
01036       }
01037     }
01038   } else {
01039     if (maptype == 1) {
01040       for (j=0;j<mapheight;j++) {
01041         for (i=0;i<mapwidth;i++) {
01042           *mymappt = (short int) MapGetshort (mdatpt);
01043           mdatpt+=2; mymappt++;
01044         }
01045       }
01046     } else {
01047       if (maptype == 2) {
01048         for (j=0;j<mapheight;j++) {
01049           for (i=0;i<mapwidth;) {
01050             k = (int) MapGetshort (mdatpt);
01051             mdatpt += 2;
01052             if (k > 0) {
01053               while (k) {
01054                 *mymappt = (short int) MapGetshort (mdatpt);
01055                 mymappt++; mdatpt += 2;
01056                 i++; k--;
01057               }
01058             } else {
01059               if (k < 0) {
01060                 l = (int) MapGetshort (mdatpt); mdatpt += 2;
01061                 while (k) {
01062                   *mymappt = (short int) l;
01063                   mymappt++;
01064                   i++; k++;
01065                 }
01066               } else {
01067               } }
01068           }
01069         }
01070       } else {
01071         if (maptype == 3) {
01072           for (j=0;j<mapheight;j++) {
01073             for (i=0;i<mapwidth;) {
01074               k = (int) MapGetshort (mdatpt);
01075               mdatpt += 2;
01076               if (k > 0) {
01077                 while (k) {
01078                   *mymappt = (short int) MapGetshort (mdatpt);
01079                   mymappt++; mdatpt += 2;
01080                   i++; k--;
01081                 }
01082               } else {
01083                 if (k < 0) {
01084                   mymap2pt = mymappt + (int) MapGetshort (mdatpt); mdatpt += 2;
01085                   while (k) {
01086                     *mymappt = *mymap2pt;
01087                     mymappt++; mymap2pt++;
01088                     i++; k++;
01089                   }
01090                 } else {
01091                 } }
01092             }
01093           }
01094         } } } }
01095 
01096   if (lnum == 0) { mappt = mapmappt[lnum]; }
01097   return 0;
01098 }

int MapDecodeMAR unsigned char *  mrpt,
int  marlyr
 

Definition at line 302 of file mappyal.c.

References mapheight, mapmappt, and mapwidth.

00303 {
00304   int i, j;
00305   short int * mymarpt;
00306 
00307   if (marlyr < 0 || marlyr > 7) return -1;
00308 
00309   if (mapmappt[marlyr] == NULL)
00310     mapmappt[marlyr] = malloc (mapwidth*mapheight*sizeof(short int));
00311 
00312   memcpy (mapmappt[marlyr], mrpt, (mapwidth*mapheight*sizeof(short int)));
00313 
00314   mymarpt = mapmappt[marlyr];
00315   j = 0; for (i=0;i<(mapwidth*mapheight);i++) { if (mymarpt[i]&0xF) j = 1; }
00316   if (j == 0) {
00317     for (i=0;i<(mapwidth*mapheight);i++) {
00318       if (mymarpt[i] >= 0) mymarpt[i] /= 32;
00319       else mymarpt[i] /= 16;
00320     }
00321   }
00322 
00323   return 0;
00324 }

int MapDecodeMPHD unsigned char *  mdatpt  ) 
 

Definition at line 748 of file mappyal.c.

References mapaltdepth, mapblockgapx, mapblockgapy, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrsize, mapblockwidth, mapdepth, maperror, mapheight, mapislsb, mapnumblockgfx, mapnumblockstr, maptype, mapwidth, and MER_MAPTOONEW.

Referenced by MapRealDecode().

00749 {
00750   mdatpt += 8;
00751   if (mdatpt[0] > 1) { maperror = MER_MAPTOONEW; return -1; }
00752   if (mdatpt[2] == 1) mapislsb = 1; else mapislsb = 0;
00753 
00754   maptype = (int) mdatpt[3];
00755   if (maptype > 3) { maperror = MER_MAPTOONEW; return -1; }
00756   mapwidth = (short) MapGetshort (mdatpt+4);
00757   mapheight = (short) MapGetshort (mdatpt+6);
00758   mapblockwidth = (short) MapGetshort (mdatpt+12);
00759   mapblockheight = (short) MapGetshort (mdatpt+14);
00760   mapdepth = (short) MapGetshort (mdatpt+16);
00761   mapaltdepth = mapdepth;
00762   mapblockstrsize = (short) MapGetshort (mdatpt+18);
00763   mapnumblockstr = (short) MapGetshort (mdatpt+20);
00764   mapnumblockgfx = (short) MapGetshort (mdatpt+22);
00765 
00766   if (MapGetchksz (mdatpt-4) > 28) {
00767     mapblockgapx = (int) MapGetshort (mdatpt+28);
00768     mapblockgapy = (int) MapGetshort (mdatpt+30);
00769     mapblockstaggerx = (int) MapGetshort (mdatpt+32);
00770     mapblockstaggery = (int) MapGetshort (mdatpt+34);
00771   } else {
00772     mapblockgapx = (int) mapblockwidth;
00773     mapblockgapy = (int) mapblockheight;
00774     mapblockstaggerx = 0;
00775     mapblockstaggery = 0;
00776   }
00777   if (MapGetchksz (mdatpt-4) > 36) mapclickmask = (short) MapGetshort (mdatpt+36);
00778   else mapclickmask = 0;
00779 
00780   return 0;
00781 }

int MapDecodeNOVC unsigned char *  mdatpt  ) 
 

Definition at line 1012 of file mappyal.c.

References mapnovctext.

Referenced by MapRealDecode().

01013 {
01014   memset(mapnovctext, 0, 70);
01015   if (MapGetchksz (mdatpt+4) < 70) strncpy(mapnovctext, mdatpt+8, sizeof(mdatpt+8));  /* strcpy is unsafe.  strncpy atleast checks the size of oone string... */
01016   return 0;
01017 }

int MapDecodeNULL unsigned char *  mdatpt  ) 
 

Definition at line 1100 of file mappyal.c.

Referenced by MapRealDecode().

01101 {
01102   return 0;
01103 }

int MapDecodeVRAM unsigned char *  mapmempt  ) 
 

Definition at line 1266 of file mappyal.c.

References mapgfxinbitmaps, and MapPreRealDecode().

01267 {
01268   mapgfxinbitmaps = 1;
01269   return MapPreRealDecode (mapmempt);
01270 }

Here is the call graph for this function:

void MapDrawBG BITMAP *  mapdestpt,
int  mapxo,
int  mapyo,
int  mapx,
int  mapy,
int  mapw,
int  maph
 

Definition at line 1352 of file mappyal.c.

References abmTiles, ANISTR::ancuroff, BLKSTR::bgoff, mapanimseqpt, mapblockgapx, mapblockgapy, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrpt, mapblockwidth, mapgfxinbitmaps, mappt, and mapwidth.

Referenced by MapDrawBGT(), updatemap(), and updateplayer().

01354 {
01355   int i, j, mycl, mycr, myct, mycb, mapvclip, maphclip;
01356   int mbgx, mbgy;
01357   short int *mymappt;
01358   short int *mymap2pt;
01359   BLKSTR *blkdatapt;
01360   ANISTR *myanpt;
01361 
01362   if (!mapgfxinbitmaps) {
01363     return;
01364   } else {
01365     mycl = mapdestpt->cl;
01366     mycr = mapdestpt->cr;
01367     myct = mapdestpt->ct;
01368     mycb = mapdestpt->cb;
01369     set_clip_rect(mapdestpt, mapx, mapy, mapx+mapw-1, mapy+maph-1);
01370     mapxo -= mapblockstaggerx;
01371     mapyo -= mapblockstaggery;
01372     mymappt = (short int *) mappt;
01373     if (mapblockstaggerx || mapblockstaggery) {
01374       mymappt += (mapxo/mapblockgapx)+((mapyo/mapblockgapy)*mapwidth*2);
01375       mbgx = mapblockgapx;
01376       mbgy = mapblockgapy;
01377     } else {
01378       mymappt += (mapxo/mapblockgapx)+((mapyo/mapblockgapy)*mapwidth);
01379       mbgx = 0;
01380       mbgy = 0;
01381     }
01382     mapvclip = mapyo%mapblockgapy;
01383     maphclip = mapxo%mapblockgapx;
01384 
01385     mymap2pt = mymappt;
01386     for (j=((mapy-mapvclip)-mbgy);j<((mapy+maph));j+=mapblockgapy) {
01387       for (i=((mapx-maphclip)-mbgx);i<((mapx+mapw));i+=mapblockgapx) {
01388         if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01389         else { myanpt = mapanimstrendpt + *mymappt;
01390         blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01391         if (mapblockstaggerx || mapblockstaggery) {
01392           if (abmTiles[0] != (BITMAP *) blkdatapt->bgoff)
01393             masked_blit ((BITMAP *) blkdatapt->bgoff, mapdestpt, 0, 0, i, j, mapblockwidth, mapblockheight);
01394         } else {
01395           blit ((BITMAP *) blkdatapt->bgoff, mapdestpt, 0, 0, i, j, mapblockwidth, mapblockheight);
01396         }
01397         mymappt++;
01398       }
01399       if (mapblockstaggerx || mapblockstaggery) {
01400         mymap2pt += mapwidth;
01401         mymappt = mymap2pt;
01402         for (i=(((mapx-maphclip)-mbgx)+mapblockstaggerx);i<((mapx+mapw));i+=mapblockgapx) {
01403           if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01404           else { myanpt = mapanimstrendpt + *mymappt;
01405           blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01406           if (abmTiles[0] != (BITMAP *) blkdatapt->bgoff)
01407             masked_blit ((BITMAP *) blkdatapt->bgoff, mapdestpt, 0, 0, i, j+mapblockstaggery, mapblockwidth, mapblockheight);
01408           mymappt++;
01409         }
01410       }
01411       mymap2pt += mapwidth;
01412       mymappt = mymap2pt;
01413     }
01414 
01415     set_clip_rect(mapdestpt, mycl, myct, mycr+1, mycb+1);
01416   }
01417 }

void MapDrawBGT BITMAP *  mapdestpt,
int  mapxo,
int  mapyo,
int  mapx,
int  mapy,
int  mapw,
int  maph
 

Definition at line 1419 of file mappyal.c.

References abmTiles, ANISTR::ancuroff, BLKSTR::bgoff, mapanimseqpt, mapblockgapx, mapblockgapy, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrpt, mapblockwidth, MapDrawBG(), mapgfxinbitmaps, mappt, mapwidth, and BLKSTR::trigger.

01421 {
01422   int i, j, mycl, mycr, myct, mycb, mapvclip, maphclip;
01423   short int *mymappt;
01424   short int *mymap2pt;
01425   BLKSTR *blkdatapt;
01426   ANISTR *myanpt;
01427 
01428   if (mapblockstaggerx || mapblockstaggery) {
01429     MapDrawBG (mapdestpt, mapxo, mapyo, mapx, mapy, mapw, maph);
01430     return;
01431   }
01432   if (!mapgfxinbitmaps) {
01433     return;
01434   } else {
01435     mycl = mapdestpt->cl;
01436     mycr = mapdestpt->cr;
01437     myct = mapdestpt->ct;
01438     mycb = mapdestpt->cb;
01439     set_clip_rect(mapdestpt, mapx, mapy, mapx+mapw-1, mapy+maph-1);
01440     mymappt = (short int *) mappt;
01441     mymappt += (mapxo/mapblockgapx)+((mapyo/mapblockgapy)*mapwidth);
01442     mapvclip = mapyo%mapblockgapy;
01443     maphclip = mapxo%mapblockgapx;
01444 
01445     mymap2pt = mymappt;
01446     for (j=(mapy-mapvclip);j<((mapy+maph));j+=mapblockgapy) {
01447       for (i=(mapx-maphclip);i<((mapx+mapw));i+=mapblockgapx) {
01448         if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01449         else { myanpt = mapanimstrendpt + *mymappt;
01450         blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01451         if (blkdatapt->trigger) {
01452           if (abmTiles[0] != (BITMAP *) blkdatapt->bgoff)
01453             masked_blit ((BITMAP *) blkdatapt->bgoff, mapdestpt, 0, 0, i, j, mapblockwidth, mapblockheight);
01454         } else {
01455           blit ((BITMAP *) blkdatapt->bgoff, mapdestpt, 0, 0, i, j, mapblockwidth, mapblockheight);
01456         }
01457         mymappt++;
01458       }
01459       mymap2pt += mapwidth;
01460       mymappt = mymap2pt;
01461     }
01462 
01463     set_clip_rect(mapdestpt, mycl, myct, mycr+1, mycb+1);
01464   }
01465 }

Here is the call graph for this function:

void MapDrawFG BITMAP *  mapdestpt,
int  mapxo,
int  mapyo,
int  mapx,
int  mapy,
int  mapw,
int  maph,
int  mapfg
 

Definition at line 1467 of file mappyal.c.

References ANISTR::ancuroff, BLKSTR::fgoff, BLKSTR::fgoff2, BLKSTR::fgoff3, mapanimseqpt, mapblockgapx, mapblockgapy, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrpt, mapblockwidth, mapgfxinbitmaps, mappt, and mapwidth.

Referenced by updatemap(), and updateplayer().

01469 {
01470   int i, j, mycl, mycr, myct, mycb, mapvclip, maphclip;
01471   int mbgx, mbgy;
01472   short int *mymappt;
01473   short int *mymap2pt;
01474   BLKSTR *blkdatapt;
01475   ANISTR *myanpt;
01476   BITMAP *mapgfxpt;
01477 
01478   if (!mapgfxinbitmaps) {
01479     return;
01480   } else {
01481     mycl = mapdestpt->cl;
01482     mycr = mapdestpt->cr;
01483     myct = mapdestpt->ct;
01484     mycb = mapdestpt->cb;
01485     set_clip_rect(mapdestpt, mapx, mapy, mapx+mapw-1, mapy+maph-1);
01486     mapxo -= mapblockstaggerx;
01487     mapyo -= mapblockstaggery;
01488     mymappt = (short int *) mappt;
01489     if (mapblockstaggerx || mapblockstaggery) {
01490       mymappt += (mapxo/mapblockgapx)+((mapyo/mapblockgapy)*mapwidth*2);
01491       mbgx = mapblockgapx;
01492       mbgy = mapblockgapy;
01493     } else {
01494       mymappt += (mapxo/mapblockgapx)+((mapyo/mapblockgapy)*mapwidth);
01495       mbgx = 0;
01496       mbgy = 0;
01497     }
01498     mapvclip = mapyo%mapblockgapy;
01499     maphclip = mapxo%mapblockgapx;
01500 
01501     mymap2pt = mymappt;
01502     for (j=((mapy-mapvclip)-mbgy);j<((mapy+maph));j+=mapblockgapy) {
01503       for (i=((mapx-maphclip)-mbgx);i<((mapx+mapw));i+=mapblockgapx) {
01504         if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01505         else { myanpt = mapanimstrendpt + *mymappt;
01506         blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01507         if (!mapfg) mapgfxpt = (BITMAP *) blkdatapt->fgoff;
01508         else if (mapfg == 1) mapgfxpt = (BITMAP *) blkdatapt->fgoff2;
01509         else mapgfxpt = (BITMAP *) blkdatapt->fgoff3;
01510         if (((int)mapgfxpt) != 0)
01511           masked_blit (mapgfxpt, mapdestpt, 0, 0, i, j, mapblockwidth, mapblockheight);
01512         mymappt++;
01513       }
01514       if (mapblockstaggerx || mapblockstaggery) {
01515         mymap2pt += mapwidth;
01516         mymappt = mymap2pt;
01517         for (i=(((mapx-maphclip)-mbgx)+mapblockstaggerx);i<((mapx+mapw));i+=mapblockgapx) {
01518           if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01519           else { myanpt = mapanimstrendpt + *mymappt;
01520           blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01521           if (!mapfg) mapgfxpt = (BITMAP *) blkdatapt->fgoff;
01522           else if (mapfg == 1) mapgfxpt = (BITMAP *) blkdatapt->fgoff2;
01523           else mapgfxpt = (BITMAP *) blkdatapt->fgoff3;
01524           if (((int)mapgfxpt) != 0)
01525             masked_blit (mapgfxpt, mapdestpt, 0, 0, i, j+mapblockstaggery, mapblockwidth, mapblockheight);
01526           mymappt++;
01527         }
01528       }
01529       mymap2pt += mapwidth;
01530       mymappt = mymap2pt;
01531     }
01532 
01533     set_clip_rect(mapdestpt, mycl, myct, mycr+1, mycb+1);
01534   }
01535 }

void MapDrawParallax BITMAP *  mapdestpt,
BITMAP *  parbm,
int  mapxo,
int  mapyo,
int  mapx,
int  mapy,
int  mapw,
int  maph
 

Definition at line 1295 of file mappyal.c.

References ANISTR::ancuroff, mapanimseqpt, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrpt, mapblockwidth, mappt, mapwidth, and BLKSTR::trigger.

01306 {
01307   int mycl, mycr, myct, mycb;
01308   int i, i2, j;
01309   int paraxo, paraxo2, parayo;
01310   short int * mymappt, * mymappt2;
01311   BLKSTR * blkdatapt;
01312   ANISTR * myanpt;
01313 
01314   if (mapblockstaggerx || mapblockstaggery) return;
01315   mycl = mapdestpt->cl;
01316   mycr = mapdestpt->cr;
01317   myct = mapdestpt->ct;
01318   mycb = mapdestpt->cb;
01319   set_clip_rect (mapdestpt, mapx, mapy, mapx+mapw-1, mapy+maph-1);
01320 
01321   mymappt = (short int *) mappt;
01322   mymappt += (mapxo/mapblockwidth)+((mapyo/mapblockheight)*mapwidth);
01323 
01324   paraxo = ((mapxo-(mapxo%mapblockwidth))%(parbm->w-mapblockwidth))-((mapxo/2)%(parbm->w-mapblockwidth));
01325   parayo = ((mapyo-(mapyo%mapblockheight))%(parbm->h-mapblockheight))-((mapyo/2)%(parbm->h-mapblockheight));
01326   while (paraxo < 0) paraxo += (parbm->w-mapblockwidth);
01327   while (parayo < 0) parayo += (parbm->h-mapblockheight);
01328 
01329   i = mapx-(mapxo%mapblockwidth);
01330   j = mapy-(mapyo%mapblockheight);
01331 
01332   i2 = i; paraxo2 = paraxo; mymappt2 = mymappt;
01333   while (j < (mapy+maph)) {
01334     while (i < (mapx+mapw)) {
01335       if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01336       else { myanpt = mapanimstrendpt + *mymappt;
01337       blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01338       if (blkdatapt->trigger)
01339         blit (parbm, mapdestpt, paraxo, parayo, i, j, mapblockwidth, mapblockheight);
01340       paraxo += mapblockwidth;
01341       if (paraxo >= (parbm->w-mapblockwidth)) paraxo -= (parbm->w-mapblockwidth);
01342       i += mapblockwidth; mymappt++;
01343     }
01344     parayo += mapblockheight;
01345     if (parayo >= (parbm->h-mapblockheight)) parayo -= (parbm->h-mapblockheight);
01346     i = i2; paraxo = paraxo2; mymappt2 += mapwidth; mymappt = mymappt2;
01347     j += mapblockheight;
01348   }
01349   set_clip_rect(mapdestpt, mycl, myct, mycr+1, mycb+1);
01350 }

void MapDrawRow BITMAP *  mapdestpt,
int  mapxo,
int  mapyo,
int  mapx,
int  mapy,
int  mapw,
int  maph,
int  maprw,
void(*)(int cx, int cy, int dx, int dy)  cellcall
 

Definition at line 1537 of file mappyal.c.

References ANISTR::ancuroff, BLKSTR::bgoff, BLKSTR::fgoff, BLKSTR::fgoff2, BLKSTR::fgoff3, mapanimseqpt, mapblockgapx, mapblockgapy, mapblockheight, mapblockstaggerx, mapblockstaggery, mapblockstrpt, mapblockwidth, mapgfxinbitmaps, mapheight, mappt, mapwidth, BLKSTR::unused1, BLKSTR::unused2, and BLKSTR::unused3.

01539 {
01540   int i, j, mycl, mycr, myct, mycb, mapvclip, maphclip;
01541   int mbgx, mbgy, bfield, bysub;
01542   int cx, cy;
01543   short int *mymappt;
01544   short int *mymap2pt;
01545   BLKSTR *blkdatapt;
01546   ANISTR *myanpt;
01547   BITMAP *mapgfxpt;
01548 
01549   if (((mapyo/mapblockgapy)+maprw) >= mapheight) return;
01550   if (mapblockstaggerx || mapblockstaggery) {
01551     mapxo -= mapblockstaggerx;
01552     mapyo -= mapblockstaggery;
01553     if ((((mapyo/mapblockgapy)*2)+maprw) >= (mapheight-1)) return;
01554   }
01555   if (!mapgfxinbitmaps) {
01556     return;
01557   } else {
01558     mycl = mapdestpt->cl;
01559     mycr = mapdestpt->cr;
01560     myct = mapdestpt->ct;
01561     mycb = mapdestpt->cb;
01562     set_clip_rect(mapdestpt, mapx, mapy, mapx+mapw-1, mapy+maph-1);
01563     mymappt = (short int *) mappt;
01564     mapvclip = mapyo%mapblockgapy;
01565     maphclip = mapxo%mapblockgapx;
01566     j = (mapy-mapvclip); i = 0;
01567     if (mapblockstaggerx || mapblockstaggery) {
01568       cx = mapxo/mapblockgapx;
01569       cy = (((mapyo/mapblockgapy)*2)+maprw);
01570       mymappt += (cx)+(cy*mapwidth);
01571       mbgx = mapblockgapx;
01572       mbgy = mapblockgapy;
01573       j -= mbgy;
01574       j += ((maprw/2)*mapblockgapy);
01575       if (maprw&1) { j += mapblockstaggery; i = mapblockstaggerx; }
01576     } else {
01577       cx = mapxo/mapblockgapx;
01578       cy = ((mapyo/mapblockgapy)+maprw);
01579       mymappt += (cx)+(cy*mapwidth);
01580       mbgx = 0;
01581       mbgy = 0;
01582       j += (maprw*mapblockgapy);
01583     }
01584 
01585     mymap2pt = mymappt;
01586     for (i+=((mapx-maphclip)-mbgx);i<((mapx+mapw));i+=mapblockgapx) {
01587       if (cellcall != NULL) cellcall (cx, cy, i, j);
01588       if (*mymappt>=0) blkdatapt = ((BLKSTR*) mapblockstrpt) + *mymappt;
01589       else { myanpt = mapanimstrendpt + *mymappt;
01590       blkdatapt = ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
01591       bfield = 1; bysub = 0;
01592       do {
01593         if (!bfield) blkdatapt++;
01594         for (;bfield<4;bfield++) {
01595           switch (bfield) {
01596           case 0: mapgfxpt = (BITMAP *) blkdatapt->bgoff; break;
01597           case 1: mapgfxpt = (BITMAP *) blkdatapt->fgoff; break;
01598           case 2: mapgfxpt = (BITMAP *) blkdatapt->fgoff2; break;
01599           default:
01600           case 3: mapgfxpt = (BITMAP *) blkdatapt->fgoff3; break;
01601           }
01602           if (((int)mapgfxpt) != 0) {
01603             if (blkdatapt->unused2 && !blkdatapt->unused3) {
01604               masked_blit (mapgfxpt, mapdestpt, 0, 0, i, j-bysub, mapblockwidth/2, mapblockheight);
01605             } else {
01606               if (!blkdatapt->unused2 && blkdatapt->unused3) {
01607                 masked_blit (mapgfxpt, mapdestpt, mapblockwidth/2, 0, i, j-bysub, mapblockwidth/2, mapblockheight);
01608               } else {
01609                 masked_blit (mapgfxpt, mapdestpt, 0, 0, i, j-bysub, mapblockwidth, mapblockheight);
01610               }
01611             }
01612           }
01613           bysub += mapblockheight;
01614         }
01615         bfield = 0;
01616       } while (blkdatapt->unused1);
01617       mymappt++; cx++;
01618     }
01619 
01620     set_clip_rect(mapdestpt, mycl, myct, mycr+1, mycb+1);
01621   }
01622 }

void MapFreeMem void   ) 
 

Definition at line 455 of file mappyal.c.

References abmTiles, mapanimseqpt, maparraypt, mapblockgfxpt, mapblocksinsysmem, mapblocksinvidmem, mapblockstrpt, mapcmappt, mapmaparraypt, mapmappt, mapnovctext, and mappt.

Referenced by main(), MapPreRealDecode(), MapRealDecode(), MapRelocate(), and MapRelocate2().

00456 {
00457   int i;
00458   for (i=0;i<8;i++) { if (mapmappt[i]!=NULL) { free (mapmappt[i]); mapmappt[i] = NULL; } }
00459   mappt = NULL;
00460   for (i=0;i<8;i++) { if (mapmaparraypt[i]!=NULL) { free (mapmaparraypt[i]); mapmaparraypt[i] = NULL; } }
00461   maparraypt = NULL;
00462   if (mapcmappt!=NULL) { free (mapcmappt); mapcmappt = NULL; }
00463   if (mapblockgfxpt!=NULL) { free (mapblockgfxpt); mapblockgfxpt = NULL; }
00464   if (mapblockstrpt!=NULL) { free (mapblockstrpt); mapblockstrpt = NULL; }
00465   if (mapanimseqpt!=NULL) { free (mapanimseqpt); mapanimseqpt = NULL; }
00466   if (mapanimstrpt!=NULL) { free (mapanimstrpt); mapanimstrpt = NULL; }
00467   if (abmTiles != NULL) {
00468     i = 0; while (abmTiles[i]!=NULL) { destroy_bitmap (abmTiles[i]); i++; }
00469     free (abmTiles); abmTiles = NULL;
00470   }
00471   mapnovctext[0] = 0;
00472   mapblocksinvidmem = 0; mapblocksinsysmem = 0;
00473 }

int MapGenerateYLookup void   ) 
 

Definition at line 92 of file mappyal.c.

References maparraypt, mapheight, mapmaparraypt, mapmappt, mappt, and mapwidth.

00093 {
00094 int i, j;
00095 
00096         for (i=0;i<8;i++) {
00097                 if (mapmaparraypt[i]!=NULL) { free (mapmaparraypt[i]); mapmaparraypt[i] = NULL; }
00098                 if (mapmappt[i]!=NULL) {
00099                         mapmaparraypt[i] = malloc (mapheight*sizeof(short int *));
00100                         if (mapmaparraypt[i] == NULL) return -1;
00101                         for (j=0;j<mapheight;j++) mapmaparraypt[i][j] = (mapmappt[i]+(j*mapwidth));
00102                         if (mapmappt[i] == mappt) maparraypt = mapmaparraypt[i];
00103                 }
00104         }
00105         return 0;
00106 }

BLKSTR* MapGetBlock int  x,
int  y
 

Definition at line 207 of file mappyal.c.

References ANISTR::ancuroff, mapanimseqpt, maparraypt, mapblockstrpt, mappt, and mapwidth.

Referenced by collided().

00208 {
00209   short int * mymappt;
00210   ANISTR * myanpt;
00211 
00212   if (maparraypt!= NULL) {
00213     mymappt = maparraypt[y]+x;
00214   } else {
00215     mymappt = mappt;
00216     mymappt += x;
00217     mymappt += y*mapwidth;
00218   }
00219   if (*mymappt>=0) return ((BLKSTR*) mapblockstrpt) + *mymappt;
00220   else { myanpt = mapanimstrendpt + *mymappt;
00221   return ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
00222 }

int MapGetBlockID int  blid,
int  usernum
 

Definition at line 265 of file mappyal.c.

References mapblockstrpt, and mapnumblockstr.

00266 {
00267   int i;
00268   BLKSTR * myblkpt;
00269 
00270   myblkpt = (BLKSTR *) mapblockstrpt;
00271   if (myblkpt == NULL) return -1;
00272 
00273   for (i=0;i<mapnumblockstr;i++) {
00274     switch (usernum) {
00275     case 1:
00276       if (myblkpt[i].user1 == blid) return i;
00277       break;
00278     case 2:
00279       if (myblkpt[i].user2 == blid) return i;
00280       break;
00281     case 3:
00282       if (myblkpt[i].user3 == blid) return i;
00283       break;
00284     case 4:
00285       if (myblkpt[i].user4 == blid) return i;
00286       break;
00287     case 5:
00288       if (myblkpt[i].user5 == blid) return i;
00289       break;
00290     case 6:
00291       if (myblkpt[i].user6 == blid) return i;
00292       break;
00293     case 7:
00294       if (myblkpt[i].user7 == blid) return i;
00295       break;
00296     }
00297   }
00298 
00299   return -1;
00300 }

BLKSTR* MapGetBlockInPixels int  x,
int  y
 

Definition at line 183 of file mappyal.c.

References ANISTR::ancuroff, mapanimseqpt, maparraypt, mapblockheight, mapblockstrpt, mapblockwidth, MapGetXOffset(), MapGetYOffset(), mapheight, mappt, and mapwidth.

00184 {
00185   int xp, yp;
00186   short int * mymappt;
00187   ANISTR * myanpt;
00188 
00189   if (x < 0 || y < 0 || x >= (mapwidth*mapblockwidth) || y >= (mapheight*mapblockheight)) return NULL;
00190 
00191   xp = x; yp = y;
00192   x = MapGetXOffset (xp, yp);
00193   y = MapGetYOffset (xp, yp);
00194 
00195   if (maparraypt!= NULL) {
00196     mymappt = maparraypt[y]+x;
00197   } else {
00198     mymappt = mappt;
00199     mymappt += x;
00200     mymappt += y*mapwidth;
00201   }
00202   if (*mymappt>=0) return ((BLKSTR*) mapblockstrpt) + *mymappt;
00203   else { myanpt = mapanimstrendpt + *mymappt;
00204   return ((BLKSTR *) mapblockstrpt) + mapanimseqpt[myanpt->ancuroff]; }
00205 }

Here is the call graph for this function:

int MapGetXOffset int  xpix,
int  ypix
 

Definition at line 146 of file mappyal.c.

References mapblockgapx, mapblockstaggerx, mapblockstaggery, and mapwidth.

Referenced by MapGetBlockInPixels(), and MapSetBlockInPixels().

00147 {
00148   int xb;
00149 
00150   if (mapblockstaggerx || mapblockstaggery) {
00151     xpix += (mapblockstaggerx);
00152     ypix += (mapblockstaggery);
00153   }
00154   xb = xpix/mapblockgapx;
00155 
00156   if ((mapblockstaggerx || mapblockstaggery) && mapclickmask) xb += MEClickmask (xpix, ypix, 0);
00157 
00158   if (xb < 0) xb = 0;
00159   if (xb >= mapwidth) xb = mapwidth-1;
00160   return xb;
00161 }

int MapGetYOffset int  xpix,
int  ypix
 

Definition at line 163 of file mappyal.c.

References mapblockgapy, mapblockstaggerx, mapblockstaggery, and mapheight.

Referenced by MapGetBlockInPixels(), and MapSetBlockInPixels().

00164 {
00165   int yb;
00166 
00167   if (mapblockstaggerx || mapblockstaggery) {
00168     xpix += (mapblockstaggerx);
00169     ypix += (mapblockstaggery);
00170   }
00171   yb = ypix/mapblockgapy;
00172 
00173   if ((mapblockstaggerx || mapblockstaggery) && mapclickmask) {
00174     yb *= 2;
00175     yb += MEClickmask (xpix, ypix, 1);
00176   }
00177 
00178   if (yb < 0) yb = 0;
00179   if (yb >= mapheight) yb = mapheight-1;
00180   return yb;
00181 }

void MapInitAnims void   ) 
 

Definition at line 358 of file mappyal.c.

References AN_LOOPR, AN_ONCE, AN_ONCES, AN_PPFF, AN_PPFR, AN_PPRF, AN_PPRR, ANISTR::ancount, ANISTR::ancuroff, ANISTR::andelay, ANISTR::anendoff, ANISTR::anstartoff, and ANISTR::antype.

Referenced by MapDecodeANDT().

00359 {
00360   ANISTR * myanpt;
00361   if (mapanimstrpt==NULL) return;
00362   myanpt = (ANISTR *) mapanimstrendpt; myanpt--;
00363   while (myanpt->antype!=-1)
00364     {
00365       if (myanpt->antype==AN_PPFR) myanpt->antype = AN_PPFF;
00366       if (myanpt->antype==AN_PPRF) myanpt->antype = AN_PPRR;
00367       if (myanpt->antype==AN_ONCES) myanpt->antype = AN_ONCE;
00368       if ((myanpt->antype==AN_LOOPR) || (myanpt->antype==AN_PPRR))
00369         {
00370           myanpt->ancuroff = myanpt->anstartoff;
00371           if ((myanpt->anstartoff)!=(myanpt->anendoff)) myanpt->ancuroff=(myanpt->anendoff)-1;
00372         } else {
00373           myanpt->ancuroff = myanpt->anstartoff;
00374         }
00375       myanpt->ancount = myanpt->andelay;
00376       myanpt--;
00377     }
00378 }

int MapLoad char *  mapname  ) 
 

Definition at line 1215 of file mappyal.c.

References mapgfxinbitmaps, and MapRealLoad().

Referenced by initialize().

01216 {
01217   mapgfxinbitmaps = 2;
01218   return MapRealLoad (mapname);
01219 }

Here is the call graph for this function:

int MapLoadABM char *  mapname  ) 
 

Definition at line 1227 of file mappyal.c.

References mapgfxinbitmaps, and MapRealLoad().

01228 {
01229   mapgfxinbitmaps = 2;
01230   return MapRealLoad (mapname);
01231 }

Here is the call graph for this function:

int MapLoadMAR char *  mname,
int  marlyr
 

Definition at line 326 of file mappyal.c.

References mapheight, mapmappt, and mapwidth.

00327 {
00328   int i, j;
00329   short int * mymarpt;
00330   PACKFILE * marfpt;
00331 
00332   if (marlyr < 0 || marlyr > 7) return -1;
00333 
00334   marfpt = pack_fopen (mname, "rp");
00335   if (marfpt==NULL) { marfpt = pack_fopen (mname, "r");
00336   if (marfpt==NULL) { return -1; } }
00337 
00338   if (mapmappt[marlyr] == NULL)
00339     mapmappt[marlyr] = malloc (mapwidth*mapheight*sizeof(short int));
00340 
00341   if (pack_fread (mapmappt[marlyr], (mapwidth*mapheight*sizeof(short int)), marfpt) !=
00342       (mapwidth*mapheight*sizeof(short int))) { pack_fclose (marfpt); return -1; }
00343 
00344   pack_fclose (marfpt);
00345 
00346   mymarpt = mapmappt[marlyr];
00347   j = 0; for (i=0;i<(mapwidth*mapheight);i++) { if (mymarpt[i]&0xF) j = 1; }
00348   if (j == 0) {
00349     for (i=0;i<(mapwidth*mapheight);i++) {
00350       if (mymarpt[i] >= 0) mymarpt[i] /= 32;
00351       else mymarpt[i] /= 16;
00352     }
00353   }
00354 
00355   return 0;
00356 }

int MapLoadVRAM char *  mapname  ) 
 

Definition at line 1221 of file mappyal.c.

References mapgfxinbitmaps, and MapRealLoad().

01222 {
01223   mapgfxinbitmaps = 1;
01224   return MapRealLoad (mapname);
01225 }

Here is the call graph for this function:

BITMAP* MapMakeParallaxBitmap BITMAP *  sourcebm,
int  style
 

Definition at line 1278 of file mappyal.c.

References mapblockheight, mapblockwidth, and mappt.

01279 {
01280   BITMAP * newbm;
01281 
01282   if (mappt == NULL) return NULL;
01283   if (style < 0 || style > 1) return NULL;
01284 
01285   if (style) newbm = create_video_bitmap (sourcebm->w+mapblockwidth, sourcebm->h+mapblockheight);
01286   else newbm = create_bitmap (sourcebm->w+mapblockwidth, sourcebm->h+mapblockheight);
01287 
01288   if (newbm == NULL) return NULL;
01289   blit (sourcebm, newbm, 0, 0, 0, 0, sourcebm->w, sourcebm->h);
01290   blit (sourcebm, newbm, 0, 0, 0, sourcebm->h, sourcebm->w, mapblockheight);
01291   blit (newbm, newbm, 0, 0, sourcebm->w, 0, mapblockwidth, sourcebm->h+mapblockheight);
01292   return newbm;
01293 }

int MapPreRealDecode unsigned char *  mapmempt  ) 
 

Definition at line 1233 of file mappyal.c.

References maperror, MapFreeMem(), MapRealDecode(), and MER_MAPLOADERROR.

Referenced by MapDecode(), MapDecodeABM(), and MapDecodeVRAM().

01234 {
01235   long int maplength;
01236 
01237   MapFreeMem ();
01238   maperror = 0;
01239 
01240   if (*mapmempt!='F') maperror = MER_MAPLOADERROR;
01241   if (*(mapmempt+1)!='O') maperror = MER_MAPLOADERROR;
01242   if (*(mapmempt+2)!='R') maperror = MER_MAPLOADERROR;
01243   if (*(mapmempt+3)!='M') maperror = MER_MAPLOADERROR;
01244   mapmempt += 4;
01245   maplength = (MapGetchksz (mapmempt))+8;
01246 
01247   if (maperror) return -1;
01248   mapmempt += 4;
01249 
01250   if (*mapmempt!='F') maperror = MER_MAPLOADERROR;
01251   if (*(mapmempt+1)!='M') maperror = MER_MAPLOADERROR;
01252   if (*(mapmempt+2)!='A') maperror = MER_MAPLOADERROR;
01253   if (*(mapmempt+3)!='P') maperror = MER_MAPLOADERROR;
01254   mapmempt+=4;
01255 
01256   if (maperror) return -1;
01257   return MapRealDecode (NULL, mapmempt, maplength);
01258 }

Here is the call graph for this function:

int MapRealDecode PACKFILE *  mfpt,
unsigned char *  mmpt,
long int  mpfilesize
 

Definition at line 1105 of file mappyal.c.

References mapaltdepth, MapDecodeAGFX(), MapDecodeANDT(), MapDecodeBGFX(), MapDecodeBKDT(), MapDecodeCMAP(), MapDecodeLayer(), MapDecodeMPHD(), MapDecodeNOVC(), MapDecodeNULL(), mapdepth, maperror, MapFreeMem(), MapRelocate(), MER_MAPLOADERROR, MER_NONE, and MER_OUTOFMEM.

Referenced by MapPreRealDecode(), and MapRealLoad().

01106 {
01107   int chkdn;
01108   unsigned char * fmappospt;
01109   char mphdr[8];
01110 
01111   MapFreeMem ();
01112   mpfilesize -= 12;
01113 
01114   while (mpfilesize > 0) {
01115 
01116     if (mfpt != NULL) {
01117       if (pack_fread (mphdr, 8, mfpt) != 8) {
01118         maperror = MER_MAPLOADERROR;
01119         MapFreeMem ();
01120         return -1;
01121       }
01122       fmappospt = malloc (MapGetchksz(mphdr+4)+8);
01123       if (fmappospt == NULL) {
01124         maperror = MER_OUTOFMEM;
01125         MapFreeMem ();
01126         return -1;
01127       }
01128       memcpy (fmappospt, mphdr, 8);
01129       if (pack_fread (fmappospt+8, MapGetchksz(mphdr+4), mfpt) != MapGetchksz(mphdr+4)) {
01130         maperror = MER_MAPLOADERROR;
01131         MapFreeMem ();
01132         return -1;
01133       }
01134     } else {
01135       fmappospt = mmpt;
01136       mmpt += MapGetchksz(mmpt+4);
01137       mmpt += 8;
01138     }
01139 
01140     chkdn = 0;
01141     if (!strncmp (fmappospt, "MPHD", 4)) { chkdn = 1; MapDecodeMPHD (fmappospt); }
01142     /*          if (!strncmp (fmappospt, "ATHR", 4)) { chkdn = 1; MapDecodeATHR (fmappospt); }
01143                 if (!strncmp (fmappospt, "EDHD", 4)) { chkdn = 1; MapDecodeEDHD (fmappospt); }
01144     */
01145     if (!strncmp (fmappospt, "CMAP", 4)) { chkdn = 1; MapDecodeCMAP (fmappospt); }
01146     if (!strncmp (fmappospt, "BKDT", 4)) { chkdn = 1; MapDecodeBKDT (fmappospt); }
01147     if (!strncmp (fmappospt, "ANDT", 4)) { chkdn = 1; MapDecodeANDT (fmappospt); }
01148     if (!strncmp (fmappospt, "AGFX", 4)) { chkdn = 1; MapDecodeAGFX (fmappospt); }
01149     if (!strncmp (fmappospt, "BGFX", 4)) { chkdn = 1; MapDecodeBGFX (fmappospt); }
01150     if (!strncmp (fmappospt, "NOVC", 4)) { chkdn = 1; MapDecodeNOVC (fmappospt); }
01151     if (!strncmp (fmappospt, "BODY", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 0); }
01152     if (!strncmp (fmappospt, "LYR1", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 1); }
01153     if (!strncmp (fmappospt, "LYR2", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 2); }
01154     if (!strncmp (fmappospt, "LYR3", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 3); }
01155     if (!strncmp (fmappospt, "LYR4", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 4); }
01156     if (!strncmp (fmappospt, "LYR5", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 5); }
01157     if (!strncmp (fmappospt, "LYR6", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 6); }
01158     if (!strncmp (fmappospt, "LYR7", 4)) { chkdn = 1; MapDecodeLayer (fmappospt, 7); }
01159     if (!chkdn) MapDecodeNULL (fmappospt);
01160 
01161     mpfilesize -= 8;
01162     mpfilesize -= MapGetchksz (fmappospt+4);
01163     if (mfpt != NULL) free (fmappospt);
01164 
01165     if (maperror != MER_NONE) { MapFreeMem (); return -1; }
01166   }
01167 
01168   mapdepth = mapaltdepth;
01169   return MapRelocate ();
01170 }

Here is the call graph for this function:

int MapRealLoad char *  mname  ) 
 

Definition at line 1172 of file mappyal.c.

References maperror, mapfilept, MapRealDecode(), MER_MAPLOADERROR, MER_NONE, and MER_NOOPEN.

Referenced by MapLoad(), MapLoadABM(), and MapLoadVRAM().

01173 {
01174   int mretval;
01175   char idtag[4];
01176   unsigned char tempc;
01177   int mapfilesize = 0;
01178 
01179   maperror = MER_NONE;
01180   mapfilept = pack_fopen (mname, "rp");
01181   if (mapfilept==NULL) { mapfilept = pack_fopen (mname, "r");
01182   if (mapfilept==NULL) { maperror = MER_NOOPEN; return -1; } }
01183 
01184   maperror = MER_MAPLOADERROR;
01185   if (pack_fread (&idtag[0], 1, mapfilept) == 1) {
01186     if (pack_fread (&idtag[1], 1, mapfilept) == 1) {
01187       if (pack_fread (&idtag[2], 1, mapfilept) == 1) {
01188         if (pack_fread (&idtag[3], 1, mapfilept) == 1) {
01189           if (pack_fread (&tempc, 1, mapfilept) == 1) {
01190             mapfilesize = (((int) tempc)<<24);
01191             if (pack_fread (&tempc, 1, mapfilept) == 1) {
01192               mapfilesize |= (((int) tempc)<<16);
01193               if (pack_fread (&tempc, 1, mapfilept) == 1) {
01194                 mapfilesize |= (((int) tempc)<<8);
01195                 if (pack_fread (&tempc, 1, mapfilept) == 1) {
01196                   mapfilesize |= (((int) tempc));
01197                   mapfilesize += 8;
01198                   if (!strncmp (idtag, "FORM", 4)) {
01199                     if (pack_fread (&idtag[0], 1, mapfilept) == 1) {
01200                       if (pack_fread (&idtag[1], 1, mapfilept) == 1) {
01201                         if (pack_fread (&idtag[2], 1, mapfilept) == 1) {
01202                           if (pack_fread (&idtag[3], 1, mapfilept) == 1) {
01203                             if (!strncmp (idtag, "FMAP", 4)) maperror = MER_NONE;
01204                           } } } } }
01205                 } } } } } } } }
01206 
01207   if (maperror != MER_NONE) { pack_fclose (mapfilept); return -1; }
01208 
01209   mretval = MapRealDecode (mapfilept, NULL, mapfilesize);
01210   pack_fclose (mapfilept);
01211 
01212   return mretval;
01213 }

Here is the call graph for this function:

int MapRelocate void   ) 
 

Definition at line 622 of file mappyal.c.

References mapblockgfxpt, mapblockheight, mapblockwidth, mapcmappt, mapdepth, maperror, MapFreeMem(), mapgfxinbitmaps, mapnumblockgfx, MapRelocate2(), MER_NOACCELERATION, MER_NOSCREEN, and MER_OUTOFMEM.

Referenced by MapRealDecode().

00623 {
00624   int i, j, cdepth, pixcol, ccr, ccg, ccb;
00625   //BLKSTR * myblkstrpt;
00626   unsigned char * oldgfxpt;
00627   unsigned char * mycmappt;
00628   unsigned char * newgfxpt;
00629   unsigned char * newgfx2pt;
00630 
00631   if (screen == NULL) { MapFreeMem (); maperror = MER_NOSCREEN; return -1; }
00632   if (!gfx_capabilities&GFX_HW_VRAM_BLIT && mapgfxinbitmaps==1)
00633     { MapFreeMem (); maperror = MER_NOACCELERATION; return -1; }
00634   cdepth = bitmap_color_depth (screen);
00635   oldgfxpt = (unsigned char *) mapblockgfxpt;
00636   newgfxpt = (unsigned char *)
00637     malloc (mapblockwidth*mapblockheight*((mapdepth+1)/8)*mapnumblockgfx*((cdepth+1)/8));
00638   if (newgfxpt==NULL) { MapFreeMem (); maperror = MER_OUTOFMEM; return -1; }
00639   newgfx2pt = newgfxpt;
00640   mycmappt = (unsigned char *) mapcmappt; pixcol = 0;
00641   for (i=0;i<(mapblockwidth*mapblockheight*mapnumblockgfx);i++)
00642     {
00643       switch (mapdepth) {
00644       case 8:
00645         if (cdepth==8) pixcol = (int) *oldgfxpt; else {
00646           j = (*oldgfxpt)*3;
00647           pixcol = makecol (mycmappt[j], mycmappt[j+1], mycmappt[j+2]);
00648 #ifdef RB8BITTOPINK
00649           if (j == 0 && cdepth!=8) pixcol = makecol (255, 0, 255); }
00650 #endif
00651         oldgfxpt++;
00652         break;
00653       case 15:
00654         ccr = ((((int) *oldgfxpt)&0x7C)<<1);
00655         ccg = ((((((int) *oldgfxpt)&0x3)<<3)|(((int) *(oldgfxpt+1))>>5))<<3);
00656         ccb = (((int) *(oldgfxpt+1)&0x1F)<<3);
00657         ccr |= ((ccr>>5)&0x07);
00658         ccg |= ((ccg>>5)&0x07);
00659         ccb |= ((ccb>>5)&0x07);
00660         pixcol = makecol (ccr, ccg, ccb);
00661         if (cdepth==8) { if (ccr == 0xFF && ccg == 0 && ccb == 0xFF) pixcol = 0; }
00662         oldgfxpt += 2;
00663         break;
00664       case 16:
00665         ccr = (((int) *oldgfxpt)&0xF8);
00666         ccg = ((((((int) *oldgfxpt)&0x7)<<3)|(((int) *(oldgfxpt+1))>>5))<<2);
00667         ccb = (((int) *(oldgfxpt+1)&0x1F)<<3);
00668         ccr |= ((ccr>>5)&0x07);
00669         ccg |= ((ccg>>6)&0x03);
00670         ccb |= ((ccb>>5)&0x07);
00671         pixcol = makecol (ccr, ccg, ccb);
00672         if (cdepth==8) { if (ccr == 0xFF && ccg == 0 && ccb == 0xFF) pixcol = 0; }
00673         oldgfxpt += 2;
00674         break;
00675       case 24:
00676         pixcol = makecol (*oldgfxpt, *(oldgfxpt+1), *(oldgfxpt+2));
00677         if (cdepth==8) { if (*oldgfxpt == 0xFF && *(oldgfxpt+1) == 0 &&
00678                              *(oldgfxpt+2) == 0xFF) pixcol = 0; }
00679         oldgfxpt += 3;
00680         break;
00681       case 32:
00682         pixcol = makecol (*(oldgfxpt+1), *(oldgfxpt+2), *(oldgfxpt+3));
00683         if (cdepth==8) { if (*(oldgfxpt+1) == 0xFF && *(oldgfxpt+2) == 0 &&
00684                              *(oldgfxpt+3) == 0xFF) pixcol = 0; }
00685         oldgfxpt += 4;
00686         break;
00687       }
00688       switch (cdepth) {
00689       case 8:
00690         *newgfxpt = (unsigned char) pixcol;
00691         newgfxpt++;
00692         break;
00693       case 15:
00694       case 16:
00695         *((unsigned short int *) newgfxpt) = (unsigned short int) pixcol;
00696         newgfxpt+=2;
00697         break;
00698       case 24:
00699         *newgfxpt = (unsigned char) (pixcol>>16)&0xFF;
00700         *(newgfxpt+1) = (unsigned char) (pixcol>>8)&0xFF;
00701         *(newgfxpt+2) = (unsigned char) pixcol&0xFF;
00702         newgfxpt+=3;
00703         break;
00704       case 32:
00705         *newgfxpt = 0;
00706         *(newgfxpt+1) = (unsigned char) (pixcol>>16)&0xFF;
00707         *(newgfxpt+2) = (unsigned char) (pixcol>>8)&0xFF;
00708         *(newgfxpt+3) = (unsigned char) pixcol&0xFF;
00709         newgfxpt+=4;
00710         break;
00711       }
00712     }
00713   free (mapblockgfxpt); mapblockgfxpt = (char *) newgfx2pt;
00714 
00715   mapdepth = cdepth;
00716 
00717   return MapRelocate2 ();
00718 }

Here is the call graph for this function:

int MapRelocate2 void   ) 
 

Definition at line 522 of file mappyal.c.

References abmTiles, BLKSTR::bgoff, BLKSTR::fgoff, BLKSTR::fgoff2, BLKSTR::fgoff3, mapblockgfxpt, mapblockheight, mapblocksinsysmem, mapblocksinvidmem, mapblockstrpt, mapblockwidth, mapdepth, maperror, MapFreeMem(), mapgfxinbitmaps, mapnovctext, mapnumblockgfx, mapnumblockstr, and MER_CVBFAILED.

Referenced by MapRelocate().

00523 {
00524   int i, j, k;
00525   BLKSTR * myblkstrpt;
00526   //ANISTR * myanpt;
00527   unsigned char * newgfxpt, * novcarray;
00528   char ascnum[80];
00529   //long int * myanblkpt;
00530 
00531   i = mapnumblockstr;
00532   myblkstrpt = (BLKSTR *) mapblockstrpt;
00533 
00534   novcarray = malloc (mapnumblockgfx);
00535   memset (novcarray, 0, mapnumblockgfx);
00536   i = 0; while (mapnovctext[i] != 0) {
00537     j = 0; while (mapnovctext[i] >= '0' && mapnovctext[i] <= '9') {
00538       ascnum[j] = mapnovctext[i];
00539       i++; j++;
00540     }
00541     ascnum[j] = 0;
00542     k = atoi(ascnum);
00543     if (k < 0 || k >= mapnumblockgfx) break;
00544     if (mapnovctext[i] == '-') {
00545       i++;
00546       j = 0; while (mapnovctext[i] >= '0' && mapnovctext[i] <= '9') {
00547         ascnum[j] = mapnovctext[i];
00548         i++; j++;
00549       }
00550       ascnum[j] = 0;
00551       j = atoi(ascnum);
00552       if (j < k || j >= mapnumblockgfx) break;
00553       while (k <= j) {
00554         novcarray[k] = 1; k++;
00555       }
00556     } else {
00557       novcarray[k] = 1;
00558     }
00559     if (mapnovctext[i] == ',') i++;
00560   }
00561 
00562   if (abmTiles == NULL) abmTiles = malloc ((sizeof (BITMAP *))*(mapnumblockgfx+2));
00563   abmTiles[0] = NULL;
00564   i = 0; newgfxpt = mapblockgfxpt; while (i<mapnumblockgfx) {
00565     abmTiles[i+1] = NULL;
00566     if (mapgfxinbitmaps==1 && novcarray[i]==0) {
00567       abmTiles[i] = create_video_bitmap (mapblockwidth, mapblockheight);
00568       if (abmTiles[i] != NULL) {
00569         mapblocksinvidmem++;
00570         acquire_bitmap (abmTiles[i]);
00571       } else {
00572         abmTiles[i] = create_bitmap (mapblockwidth, mapblockheight);
00573         if (abmTiles[i] == NULL) { MapFreeMem (); maperror = MER_CVBFAILED ; return -1; }
00574         mapblocksinsysmem++;
00575       }
00576       set_clip_rect(abmTiles[i], 0, 0, 0, 0);
00577     } else {
00578       abmTiles[i] = create_bitmap (mapblockwidth, mapblockheight);
00579       if (abmTiles[i] == NULL) { MapFreeMem (); maperror = MER_CVBFAILED ; return -1; }
00580       mapblocksinsysmem++;
00581       set_clip(abmTiles[i], 0, 0, 0, 0);  /* using set_clip_rect() here screws up the maps!!! */
00582     }
00583     for (k=0;k<mapblockheight;k++) {
00584       for (j=0;j<mapblockwidth;j++) {
00585         switch (mapdepth) {
00586         case 8:
00587           putpixel (abmTiles[i], j, k, *((unsigned char *) newgfxpt));
00588           newgfxpt++;
00589           break;
00590         case 15:
00591         case 16:
00592           putpixel (abmTiles[i], j, k, *((unsigned short int *) newgfxpt));
00593           newgfxpt+=2;
00594           break;
00595         case 24:
00596           putpixel (abmTiles[i], j, k, makecol (newgfxpt[0], newgfxpt[1], newgfxpt[2]));
00597           newgfxpt+=3;
00598           break;
00599         case 32:
00600           putpixel (abmTiles[i], j, k, makecol (newgfxpt[1], newgfxpt[2], newgfxpt[3]));
00601           newgfxpt+=4;
00602           break;
00603         } } }
00604     if (is_video_bitmap(abmTiles[i])) release_bitmap (abmTiles[i]);
00605     i++;
00606   }
00607   i = mapnumblockstr; while (i) {
00608     ((BITMAP *) myblkstrpt->bgoff) = abmTiles[myblkstrpt->bgoff];
00609     if (myblkstrpt->fgoff!=0)
00610       ((BITMAP *) myblkstrpt->fgoff) = abmTiles[myblkstrpt->fgoff];
00611     if (myblkstrpt->fgoff2!=0)
00612       ((BITMAP *) myblkstrpt->fgoff2) = abmTiles[myblkstrpt->fgoff2];
00613     if (myblkstrpt->fgoff3!=0)
00614       ((BITMAP *) myblkstrpt->fgoff3) = abmTiles[myblkstrpt->fgoff3];
00615     myblkstrpt++; i--;
00616   }
00617 
00618   free (novcarray);
00619   return 0;
00620 }

Here is the call graph for this function:

void MapRestore void   ) 
 

Definition at line 488 of file mappyal.c.

References abmTiles, mapblockgfxpt, mapblockheight, mapblockwidth, mapdepth, and mapgfxinbitmaps.

00489 {
00490   int i, j, k;
00491   unsigned char * newgfxpt;
00492 
00493   if (mapgfxinbitmaps!=1 || abmTiles == NULL) return;
00494   i = 0; newgfxpt = mapblockgfxpt; while (abmTiles[i]!=NULL) {
00495     acquire_bitmap (abmTiles[i]);
00496     for (k=0;k<mapblockheight;k++) {
00497       for (j=0;j<mapblockwidth;j++) {
00498         switch (mapdepth) {
00499         case 8:
00500           putpixel (abmTiles[i], j, k, *((unsigned char *) newgfxpt));
00501           newgfxpt++;
00502           break;
00503         case 15:
00504         case 16:
00505           putpixel (abmTiles[i], j, k, *((unsigned short int *) newgfxpt));
00506           newgfxpt+=2;
00507           break;
00508         case 24:
00509           putpixel (abmTiles[i], j, k, makecol (newgfxpt[0], newgfxpt[1], newgfxpt[2]));
00510           newgfxpt+=3;
00511           break;
00512         case 32:
00513           putpixel (abmTiles[i], j, k, makecol (newgfxpt[1], newgfxpt[2], newgfxpt[3]));
00514           newgfxpt+=4;
00515           break;
00516         } } }
00517     release_bitmap (abmTiles[i]);
00518     i++;
00519   }
00520 }

void MapSetBlock int  x,
int  y,
int  strvalue
 

Definition at line 244 of file mappyal.c.

References maparraypt, mappt, and mapwidth.

00245 {
00246   short int * mymappt;
00247 
00248   if (maparraypt!= NULL) {
00249     mymappt = maparraypt[y]+x;
00250   } else {
00251     mymappt = mappt;
00252     mymappt += x;
00253     mymappt += y*mapwidth;
00254   }
00255   *mymappt = strvalue;
00256 }

void MapSetBlockInPixels int  x,
int  y,
int  strvalue
 

Definition at line 224 of file mappyal.c.

References maparraypt, mapblockheight, mapblockwidth, MapGetXOffset(), MapGetYOffset(), mapheight, mappt, and mapwidth.

00225 {
00226   int xp, yp;
00227   short int * mymappt;
00228 
00229   if (x < 0 || y < 0 || x >= (mapwidth*mapblockwidth) || y >= (mapheight*mapblockheight)) return;
00230   xp = x; yp = y;
00231   x = MapGetXOffset (xp, yp);
00232   y = MapGetYOffset (xp, yp);
00233 
00234   if (maparraypt!= NULL) {
00235     mymappt = maparraypt[y]+x;
00236   } else {
00237     mymappt = mappt;
00238     mymappt += x;
00239     mymappt += y*mapwidth;
00240   }
00241   *mymappt = strvalue;
00242 }

Here is the call graph for this function:

void MapSetPal8 void   ) 
 

Definition at line 475 of file mappyal.c.

References mapcmap6bit, and mapdepth.

00476 {
00477   if (screen!=NULL) { if ((bitmap_color_depth (screen)==8) && mapdepth == 8) set_palette (mapcmap6bit); }
00478 }

void MapUpdateAnims void   ) 
 

Definition at line 380 of file mappyal.c.

References AN_LOOPF, AN_LOOPR, AN_NONE, AN_ONCE, AN_ONCEH, AN_ONCES, AN_PPFF, AN_PPFR, AN_PPRF, AN_PPRR, ANISTR::ancount, ANISTR::ancuroff, ANISTR::andelay, ANISTR::anendoff, ANISTR::anstartoff, and ANISTR::antype.

00381 {
00382   ANISTR * myanpt;
00383 
00384   if (mapanimstrpt==NULL) return;
00385   myanpt = (ANISTR *) mapanimstrendpt; myanpt--;
00386   while (myanpt->antype!=-1)
00387     {
00388       if (myanpt->antype!=AN_NONE) { myanpt->ancount--; if (myanpt->ancount<0) {
00389         myanpt->ancount = myanpt->andelay;
00390         if (myanpt->antype==AN_LOOPF)
00391           {
00392             if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff++;
00393             if (myanpt->ancuroff==myanpt->anendoff) myanpt->ancuroff = myanpt->anstartoff;
00394             } }
00395         if (myanpt->antype==AN_LOOPR)
00396           {
00397             if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff--;
00398             if (myanpt->ancuroff==((myanpt->anstartoff)-1))
00399               myanpt->ancuroff = (myanpt->anendoff)-1;
00400             } }
00401         if (myanpt->antype==AN_ONCE)
00402           {
00403             if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff++;
00404             if (myanpt->ancuroff==myanpt->anendoff) { myanpt->antype = AN_ONCES;
00405             myanpt->ancuroff = myanpt->anstartoff; }
00406             } }
00407         if (myanpt->antype==AN_ONCEH)
00408           {
00409             if (myanpt->anstartoff!=myanpt->anendoff) {
00410               if (myanpt->ancuroff!=((myanpt->anendoff)-1)) myanpt->ancuroff++;
00411             } }
00412         if (myanpt->antype==AN_PPFF)
00413           {
00414             if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff++;
00415             if (myanpt->ancuroff==myanpt->anendoff) { myanpt->ancuroff -= 2;
00416             myanpt->antype = AN_PPFR;
00417             if (myanpt->ancuroff<myanpt->anstartoff) myanpt->ancuroff++; }
00418             } } else {
00419               if (myanpt->antype==AN_PPFR)
00420                 {
00421                   if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff--;
00422                   if (myanpt->ancuroff==((myanpt->anstartoff)-1)) { myanpt->ancuroff += 2;
00423                   myanpt->antype = AN_PPFF;
00424                   if (myanpt->ancuroff>myanpt->anendoff) myanpt->ancuroff --; }
00425                   } } }
00426         if (myanpt->antype==AN_PPRR)
00427           {
00428             if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff--;
00429             if (myanpt->ancuroff==((myanpt->anstartoff)-1)) { myanpt->ancuroff += 2;
00430             myanpt->antype = AN_PPRF;
00431             if (myanpt->ancuroff>myanpt->anendoff) myanpt->ancuroff--; }
00432             } } else {
00433               if (myanpt->antype==AN_PPRF)
00434                 {
00435                   if (myanpt->anstartoff!=myanpt->anendoff) { myanpt->ancuroff++;
00436                   if (myanpt->ancuroff==myanpt->anendoff) { myanpt->ancuroff -= 2;
00437                   myanpt->antype = AN_PPRR;
00438                   if (myanpt->ancuroff<myanpt->anstartoff) myanpt->ancuroff++; }
00439                   } } }
00440       } } myanpt--; }
00441 }


Variable Documentation

BITMAP** abmTiles = NULL
 

Definition at line 83 of file mappyal.c.

Referenced by MapDrawBG(), MapDrawBGT(), MapFreeMem(), MapRelocate2(), and MapRestore().

int mapaltdepth
 

Definition at line 85 of file mappyal.c.

Referenced by MapDecodeAGFX(), MapDecodeMPHD(), and MapRealDecode().

int* mapanimseqpt = NULL
 

Definition at line 78 of file mappyal.c.

Referenced by MapDecodeANDT(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapFreeMem(), MapGetBlock(), and MapGetBlockInPixels().

ANISTR* mapanimstrendpt
 

Definition at line 79 of file mappyal.c.

ANISTR* mapanimstrpt = NULL
 

Definition at line 77 of file mappyal.c.

short int** maparraypt = NULL
 

Definition at line 73 of file mappyal.c.

Referenced by MapChangeLayer(), MapFreeMem(), MapGenerateYLookup(), MapGetBlock(), MapGetBlockInPixels(), MapSetBlock(), and MapSetBlockInPixels().

int mapblockgapx
 

Definition at line 87 of file mappyal.c.

Referenced by MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawRow(), and MapGetXOffset().

int mapblockgapy
 

Definition at line 87 of file mappyal.c.

Referenced by MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawRow(), and MapGetYOffset().

char* mapblockgfxpt = NULL
 

Definition at line 75 of file mappyal.c.

Referenced by MapDecodeAGFX(), MapDecodeBGFX(), MapFreeMem(), MapRelocate(), MapRelocate2(), and MapRestore().

short int mapblockheight
 

Definition at line 69 of file mappyal.c.

Referenced by collided(), MapDecodeBKDT(), MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapGetBlockInPixels(), MapMakeParallaxBitmap(), MapRelocate(), MapRelocate2(), MapRestore(), MapSetBlockInPixels(), updatemap(), and updateplayer().

int mapblocksinsysmem
 

Definition at line 88 of file mappyal.c.

Referenced by MapFreeMem(), and MapRelocate2().

int mapblocksinvidmem
 

Definition at line 88 of file mappyal.c.

Referenced by MapFreeMem(), and MapRelocate2().

int mapblockstaggerx
 

Definition at line 87 of file mappyal.c.

Referenced by MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapGetXOffset(), and MapGetYOffset().

int mapblockstaggery
 

Definition at line 87 of file mappyal.c.

Referenced by MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapGetXOffset(), and MapGetYOffset().

char* mapblockstrpt = NULL
 

Definition at line 76 of file mappyal.c.

Referenced by MapDecodeBKDT(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapFreeMem(), MapGetBlock(), MapGetBlockID(), MapGetBlockInPixels(), and MapRelocate2().

short int mapblockstrsize
 

Definition at line 70 of file mappyal.c.

Referenced by MapDecodeANDT(), MapDecodeBKDT(), MapDecodeLayer(), and MapDecodeMPHD().

short int mapblockwidth
 

Definition at line 69 of file mappyal.c.

Referenced by collided(), MapDecodeBKDT(), MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapGetBlockInPixels(), MapMakeParallaxBitmap(), MapRelocate(), MapRelocate2(), MapRestore(), MapSetBlockInPixels(), updatemap(), and updateplayer().

int mapclickmask
 

Definition at line 86 of file mappyal.c.

RGB mapcmap6bit[256]
 

Definition at line 80 of file mappyal.c.

Referenced by Mapconv8to6pal(), and MapSetPal8().

char* mapcmappt = NULL
 

Definition at line 74 of file mappyal.c.

Referenced by MapDecodeCMAP(), MapFreeMem(), and MapRelocate().

short int mapdepth
 

Definition at line 69 of file mappyal.c.

Referenced by MapDecodeBKDT(), MapDecodeMPHD(), MapRealDecode(), MapRelocate(), MapRelocate2(), MapRestore(), and MapSetPal8().

int maperror
 

Definition at line 68 of file mappyal.c.

Referenced by MapDecodeAGFX(), MapDecodeANDT(), MapDecodeBGFX(), MapDecodeBKDT(), MapDecodeCMAP(), MapDecodeLayer(), MapDecodeMPHD(), MapPreRealDecode(), MapRealDecode(), MapRealLoad(), MapRelocate(), and MapRelocate2().

PACKFILE* mapfilept
 

Definition at line 71 of file mappyal.c.

Referenced by MapRealLoad().

int mapgfxinbitmaps
 

Definition at line 68 of file mappyal.c.

Referenced by MapDecode(), MapDecodeABM(), MapDecodeVRAM(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawRow(), MapLoad(), MapLoadABM(), MapLoadVRAM(), MapRelocate(), MapRelocate2(), and MapRestore().

short int mapheight
 

Definition at line 69 of file mappyal.c.

Referenced by MapDecodeLayer(), MapDecodeMAR(), MapDecodeMPHD(), MapDrawRow(), MapGenerateYLookup(), MapGetBlockInPixels(), MapGetYOffset(), MapLoadMAR(), MapSetBlockInPixels(), updatemap(), and updateplayer().

int mapislsb
 

Definition at line 86 of file mappyal.c.

Referenced by MapDecodeMPHD().

short int** mapmaparraypt[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 

Definition at line 82 of file mappyal.c.

Referenced by MapChangeLayer(), MapFreeMem(), and MapGenerateYLookup().

short int* mapmappt[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 

Definition at line 81 of file mappyal.c.

Referenced by MapChangeLayer(), MapDecodeLayer(), MapDecodeMAR(), MapFreeMem(), MapGenerateYLookup(), and MapLoadMAR().

char mapnovctext[80]
 

Definition at line 89 of file mappyal.c.

Referenced by MapDecodeNOVC(), MapFreeMem(), and MapRelocate2().

short int mapnumblockgfx
 

Definition at line 70 of file mappyal.c.

Referenced by MapDecodeMPHD(), MapRelocate(), and MapRelocate2().

short int mapnumblockstr
 

Definition at line 70 of file mappyal.c.

Referenced by MapDecodeBKDT(), MapDecodeMPHD(), MapGetBlockID(), and MapRelocate2().

short int* mappt = NULL
 

Definition at line 72 of file mappyal.c.

Referenced by MapChangeLayer(), MapDecodeLayer(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapFreeMem(), MapGenerateYLookup(), MapGetBlock(), MapGetBlockInPixels(), MapMakeParallaxBitmap(), MapSetBlock(), and MapSetBlockInPixels().

int maptype
 

Definition at line 86 of file mappyal.c.

Referenced by MapDecodeANDT(), MapDecodeBKDT(), MapDecodeLayer(), and MapDecodeMPHD().

short int mapwidth
 

Definition at line 69 of file mappyal.c.

Referenced by MapDecodeLayer(), MapDecodeMAR(), MapDecodeMPHD(), MapDrawBG(), MapDrawBGT(), MapDrawFG(), MapDrawParallax(), MapDrawRow(), MapGenerateYLookup(), MapGetBlock(), MapGetBlockInPixels(), MapGetXOffset(), MapLoadMAR(), MapSetBlock(), MapSetBlockInPixels(), updatemap(), and updateplayer().


Generated on Wed Jul 5 09:05:42 2006 for Super CS Brothers by  doxygen 1.4.4