- added semi-transparent sprites feature. (Used in masked tiles)
- fixed minor bugs git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@198 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
Commander Genius Pre-Release v0.3 (CloneKeenPlus):
|
Commander Genius Pre-Release v0.3 (CloneKeenPlus):
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
|
01-08-2009
|
||||||
|
- Masked tile can now use semi-transparent pixels. Silcar 3 ghosts use that (Tulip)
|
||||||
|
- Implemented a new dialog system. Base for the future dialogs and menus
|
||||||
|
- Minor issues
|
||||||
|
|
||||||
26-07-2009
|
26-07-2009
|
||||||
- fixed some bugs which made the game crash
|
- fixed some bugs which made the game crash
|
||||||
- removed an old and obsolete class
|
- removed an old and obsolete class
|
||||||
|
|||||||
@@ -96,10 +96,18 @@ unsigned char xa,ya;
|
|||||||
void CGraphics::drawSprite_direct(int x, int y, unsigned int t)
|
void CGraphics::drawSprite_direct(int x, int y, unsigned int t)
|
||||||
{
|
{
|
||||||
unsigned char xa,ya;
|
unsigned char xa,ya;
|
||||||
|
unsigned char oldpixel; // used for the or operation when drawing maked sprites
|
||||||
|
|
||||||
for(ya=0;ya<sprites[t].ysize;ya++)
|
for(ya=0;ya<sprites[t].ysize;ya++)
|
||||||
for(xa=0;xa<sprites[t].xsize;xa++)
|
for(xa=0;xa<sprites[t].xsize;xa++)
|
||||||
if (sprites[t].maskdata[ya][xa])
|
if ( sprites[t].maskdata[ya][xa] )
|
||||||
g_pVideoDriver->setpixel(x+xa, y+ya, sprites[t].imgdata[ya][xa]);
|
{
|
||||||
|
oldpixel = g_pVideoDriver->getpixel(x+xa, y+ya);
|
||||||
|
g_pVideoDriver->setpixel(x+xa, y+ya, (oldpixel | sprites[t].imgdata[ya][xa]) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_pVideoDriver->setpixel(x+xa, y+ya, (sprites[t].imgdata[ya][xa]==0) ? 16 :
|
||||||
|
sprites[t].imgdata[ya][xa]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::drawTile(int x, int y, unsigned int t)
|
void CGraphics::drawTile(int x, int y, unsigned int t)
|
||||||
@@ -250,11 +258,12 @@ unsigned int xstart,ystart;
|
|||||||
bufoffX = (x+xstart+scrollx_buf)&511; // offset within line
|
bufoffX = (x+xstart+scrollx_buf)&511; // offset within line
|
||||||
for(xa=xstart;xa<sprites[s].xsize;xa++)
|
for(xa=xstart;xa<sprites[s].xsize;xa++)
|
||||||
{
|
{
|
||||||
if (sprites[s].maskdata[ya][xa])
|
objects[objectnum].erasedata[ya][xa] = scrollbuffer[bufoffY+bufoffX];
|
||||||
{
|
if ( sprites[s].maskdata[ya][xa] )
|
||||||
objects[objectnum].erasedata[ya][xa] = scrollbuffer[bufoffY+bufoffX];
|
scrollbuffer[bufoffY+bufoffX] |= sprites[s].imgdata[ya][xa];
|
||||||
scrollbuffer[bufoffY+bufoffX] = sprites[s].imgdata[ya][xa];
|
else
|
||||||
}
|
scrollbuffer[bufoffY+bufoffX] = sprites[s].imgdata[ya][xa];
|
||||||
|
|
||||||
bufoffX = (bufoffX+1)&511;
|
bufoffX = (bufoffX+1)&511;
|
||||||
}
|
}
|
||||||
// move to next line and wrap to top of buffer if needed
|
// move to next line and wrap to top of buffer if needed
|
||||||
@@ -286,11 +295,8 @@ unsigned int xstart,ystart;
|
|||||||
bufoffX = (x+xstart+scrollx_buf)&511; // offset within line
|
bufoffX = (x+xstart+scrollx_buf)&511; // offset within line
|
||||||
for(xa=xstart;xa<sprites[s].xsize;xa++)
|
for(xa=xstart;xa<sprites[s].xsize;xa++)
|
||||||
{
|
{
|
||||||
if (sprites[s].maskdata[ya][xa])
|
scrollbuffer[bufoffY+bufoffX] = objects[objectnum].erasedata[ya][xa];
|
||||||
{
|
bufoffX = (bufoffX+1)&511;
|
||||||
scrollbuffer[bufoffY+bufoffX] = objects[objectnum].erasedata[ya][xa];
|
|
||||||
}
|
|
||||||
bufoffX = (bufoffX+1)&511;
|
|
||||||
}
|
}
|
||||||
// move to next line and wrap to top of buffer if needed
|
// move to next line and wrap to top of buffer if needed
|
||||||
bufoffY += 512;
|
bufoffY += 512;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifndef CLOGFILE_H_
|
#ifndef CLOGFILE_H_
|
||||||
#define CLOGFILE_H_
|
#define CLOGFILE_H_
|
||||||
|
|
||||||
#define REVISION "Commander Genius Prerelease v0.3 Pre7"
|
#define REVISION "Commander Genius Prerelease v0.3 Pre9"
|
||||||
#include "CSingleton.h"
|
#include "CSingleton.h"
|
||||||
#define g_pLogFile CLogFile::Get()
|
#define g_pLogFile CLogFile::Get()
|
||||||
|
|
||||||
|
|||||||
@@ -472,12 +472,15 @@ unsigned int temp1, temp2, temp3, temp4;
|
|||||||
|
|
||||||
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP)
|
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO: Tie that one up in convert stuff in C++
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int t;
|
int t;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
int numruns = 0;
|
int numruns = 0;
|
||||||
int gottenazero;
|
|
||||||
int resetcnt, resetpt;
|
int resetcnt, resetpt;
|
||||||
|
unsigned int planesize = 0;
|
||||||
|
|
||||||
NessieAlreadySpawned = 0;
|
NessieAlreadySpawned = 0;
|
||||||
map.isworldmap = isworldmap;
|
map.isworldmap = isworldmap;
|
||||||
@@ -498,7 +501,7 @@ int resetcnt, resetpt;
|
|||||||
curmapx = curmapy = mapdone = 0;
|
curmapx = curmapy = mapdone = 0;
|
||||||
|
|
||||||
unsigned int *filebuf; // big File Buffer for the uncompression
|
unsigned int *filebuf; // big File Buffer for the uncompression
|
||||||
filebuf = (unsigned int*) malloc(500000*sizeof(int));
|
filebuf = (unsigned int*) malloc(1000000*sizeof(int));
|
||||||
|
|
||||||
if(filebuf == NULL)
|
if(filebuf == NULL)
|
||||||
{
|
{
|
||||||
@@ -532,44 +535,32 @@ int resetcnt, resetpt;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
c=18;
|
planesize = filebuf[9];
|
||||||
|
planesize /= 2; // Size of two planes, but we only need one
|
||||||
while(c < ((filebuf[9] / 2)+18)) // Check against Tilesize
|
for( c=18 ; c<planesize+18 ; c++ ) // Check against Tilesize
|
||||||
{
|
{
|
||||||
t = filebuf[c];
|
t = filebuf[c];
|
||||||
if(!mapdone)
|
if(!mapdone)
|
||||||
addmaptile(t);
|
addmaptile(t);
|
||||||
|
|
||||||
if(t > 255)
|
if(t > 255)
|
||||||
{
|
|
||||||
t=0; // If there are some invalid values in the file
|
t=0; // If there are some invalid values in the file
|
||||||
}
|
|
||||||
|
|
||||||
c++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now do the sprites
|
||||||
// now do the enemies
|
// get sprite data
|
||||||
gottenazero = 0;
|
|
||||||
|
|
||||||
// get enemy/objectlayer data
|
|
||||||
curmapx = curmapy = mapdone = numruns = 0;
|
curmapx = curmapy = mapdone = numruns = 0;
|
||||||
resetcnt = resetpt = 0;
|
resetcnt = resetpt = 0;
|
||||||
|
|
||||||
while(!mapdone)
|
while(!mapdone)
|
||||||
{
|
{
|
||||||
t = filebuf[c];
|
t = filebuf[c];
|
||||||
|
|
||||||
if (t==0 && !gottenazero)
|
if (map.isworldmap) addobjectlayertile(t, pCKP); else addenemytile(t, pCKP);
|
||||||
{
|
if (++resetcnt==resetpt) curmapx=curmapy=0;
|
||||||
curmapx = curmapy = 0;
|
|
||||||
gottenazero = 1;
|
|
||||||
}
|
|
||||||
if (map.isworldmap) addobjectlayertile(t, pCKP); else addenemytile(t, pCKP);
|
|
||||||
if (++resetcnt==resetpt) curmapx=curmapy=0;
|
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filebuf);
|
free(filebuf);
|
||||||
|
|
||||||
|
|||||||
@@ -148,11 +148,6 @@ bool CTileLoader::load()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0 ; i<numtiles ; i++)
|
|
||||||
{
|
|
||||||
printf("tile %d: %d\n",i,TileProperty[i][0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function assigns the correct tiles that have to be changed
|
// This function assigns the correct tiles that have to be changed
|
||||||
assignChangeTileAttribute(tiles);
|
assignChangeTileAttribute(tiles);
|
||||||
|
|
||||||
|
|||||||
15
src/game.cpp
15
src/game.cpp
@@ -1073,11 +1073,11 @@ int x,y1,y2,tboundary;
|
|||||||
sprites[s].imgdata[y1][x] = tiledata[t][y2][x];
|
sprites[s].imgdata[y1][x] = tiledata[t][y2][x];
|
||||||
if (sprites[s].imgdata[y1][x] != transparentcol)
|
if (sprites[s].imgdata[y1][x] != transparentcol)
|
||||||
{
|
{
|
||||||
sprites[s].maskdata[y1][x] = 15;
|
sprites[s].maskdata[y1][x] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprites[s].maskdata[y1][x] = 0;
|
sprites[s].maskdata[y1][x] = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
y2++;
|
y2++;
|
||||||
@@ -1178,7 +1178,7 @@ int x,y,i,indx;
|
|||||||
for(x=0;x<DEMOBOX_WIDTH;x++)
|
for(x=0;x<DEMOBOX_WIDTH;x++)
|
||||||
{
|
{
|
||||||
sprites[DemoSprite].imgdata[y][x] = demobox_image[indx];
|
sprites[DemoSprite].imgdata[y][x] = demobox_image[indx];
|
||||||
sprites[DemoSprite].maskdata[y][x] = demobox_mask[indx];
|
sprites[DemoSprite].maskdata[y][x] = 15-demobox_mask[indx];
|
||||||
indx++;
|
indx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1211,15 +1211,6 @@ int x,y,i,indx;
|
|||||||
ReplaceSpriteColor(s, 1, 4, 8);
|
ReplaceSpriteColor(s, 1, 4, 8);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up mask for ice cannons (ep1)
|
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
|
||||||
{
|
|
||||||
|
|
||||||
// MakeMask(443, 155, 7);
|
|
||||||
// tiles[443].masktile = 155;
|
|
||||||
// tiles[428].masktile = 155;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP)
|
void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP)
|
||||||
|
|||||||
@@ -724,7 +724,6 @@ void CVideoDriver::setpixel(unsigned int x, unsigned int y, unsigned char c)
|
|||||||
if( x >= GAME_STD_WIDTH || y >= GAME_STD_HEIGHT ) // out of Bonds!!!
|
if( x >= GAME_STD_WIDTH || y >= GAME_STD_HEIGHT ) // out of Bonds!!!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if(BlitSurface->format->BitsPerPixel == 16)
|
if(BlitSurface->format->BitsPerPixel == 16)
|
||||||
{
|
{
|
||||||
Uint16 *ubuff16;
|
Uint16 *ubuff16;
|
||||||
@@ -749,7 +748,7 @@ void CVideoDriver::setpixel(unsigned int x, unsigned int y, unsigned char c)
|
|||||||
}
|
}
|
||||||
unsigned char CVideoDriver::getpixel(int x, int y)
|
unsigned char CVideoDriver::getpixel(int x, int y)
|
||||||
{
|
{
|
||||||
return 0;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Console" here refers to the capability to pop up in-game messages
|
// "Console" here refers to the capability to pop up in-game messages
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ bool CEGALatch::loadData(const std::string& filename, bool compresseddata)
|
|||||||
plane4 = (m_latchplanesize * 3);
|
plane4 = (m_latchplanesize * 3);
|
||||||
|
|
||||||
// ** read the 8x8 tiles **
|
// ** read the 8x8 tiles **
|
||||||
//g_pLogFile->ftextOut("latch_loadlatch(): Decoding 8x8 tiles...<br>", fname);
|
|
||||||
|
|
||||||
// set up the getbit() function of CPlanes class
|
// set up the getbit() function of CPlanes class
|
||||||
CPlanes *Planes = new CPlanes(plane1 + m_fontlocation,
|
CPlanes *Planes = new CPlanes(plane1 + m_fontlocation,
|
||||||
@@ -112,7 +111,7 @@ bool CEGALatch::loadData(const std::string& filename, bool compresseddata)
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
// Load 8x8 Tiles
|
// Load 8x8 Tiles
|
||||||
char c=0;
|
unsigned char c=0;
|
||||||
for(int p=0;p<4;p++)
|
for(int p=0;p<4;p++)
|
||||||
{
|
{
|
||||||
for(int t=0;t<m_fonttiles;t++)
|
for(int t=0;t<m_fonttiles;t++)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ bool CEGASprit::loadHead(char *data)
|
|||||||
memcpy(Sprite[i].name,data+128*i+16,12);
|
memcpy(Sprite[i].name,data+128*i+16,12);
|
||||||
memcpy(&(Sprite[i].hv_offset),data+128*i+28,4);
|
memcpy(&(Sprite[i].hv_offset),data+128*i+28,4);
|
||||||
|
|
||||||
Sprite[i].width *= 8; // Another case where the width is divided by 8
|
Sprite[i].width *= 8; // Where the width is divided by 8
|
||||||
Sprite[i].hitbox_l >>= 8;
|
Sprite[i].hitbox_l >>= 8;
|
||||||
Sprite[i].hitbox_u >>= 8;
|
Sprite[i].hitbox_u >>= 8;
|
||||||
Sprite[i].hitbox_r >>= 8;
|
Sprite[i].hitbox_r >>= 8;
|
||||||
@@ -143,7 +143,7 @@ bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
|
|||||||
c = sprites[s].imgdata[y][x];
|
c = sprites[s].imgdata[y][x];
|
||||||
}
|
}
|
||||||
c |= (Planes->getbit(RawData, p) << p);
|
c |= (Planes->getbit(RawData, p) << p);
|
||||||
if (p==3 && c==0) c = 16;
|
//if (p==3 && c==0) c = 16;
|
||||||
sprites[s].imgdata[y][x] = c;
|
sprites[s].imgdata[y][x] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
|
|||||||
{
|
{
|
||||||
for(int x=0 ; x<sprites[s].xsize ; x++)
|
for(int x=0 ; x<sprites[s].xsize ; x++)
|
||||||
{
|
{
|
||||||
sprites[s].maskdata[y][x] = (1 - Planes->getbit(RawData, 4));
|
sprites[s].maskdata[y][x] = Planes->getbit(RawData, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user