Add BALDGUY cheat for Mac data (see if anyone finds it ;-) )
This commit is contained in:
parent
ce914f552e
commit
0866c3c66c
102
2d/pcx.c
102
2d/pcx.c
|
@ -30,6 +30,7 @@ static char rcsid[] = "$Id: pcx.c,v 1.1.1.1 2006/03/17 19:38:53 zicodxx Exp $";
|
|||
#include "pcx.h"
|
||||
#include "cfile.h"
|
||||
#include "physfsx.h"
|
||||
#include "byteswap.h"
|
||||
|
||||
#define PCXHEADER_SIZE 128
|
||||
|
||||
|
@ -82,6 +83,107 @@ int PCXHeader_read_n(PCXHeader *ph, int n, CFILE *fp)
|
|||
return i;
|
||||
}
|
||||
|
||||
int bald_guy_load( char * filename, grs_bitmap * bmp,int bitmap_type ,ubyte * palette )
|
||||
{
|
||||
PCXHeader header;
|
||||
CFILE * PCXfile;
|
||||
int i, row, col, count, xsize, ysize, fsize;
|
||||
ubyte data, c, xor_value, *pixdata;
|
||||
ubyte *bguy_data, *bguy_data1, *p;
|
||||
|
||||
PCXfile = cfopen( filename , "rb" );
|
||||
if ( !PCXfile )
|
||||
return PCX_ERROR_OPENING;
|
||||
|
||||
cfseek(PCXfile, -1, SEEK_END);
|
||||
fsize = cftell(PCXfile);
|
||||
cfread(&xor_value, 1, 1, PCXfile);
|
||||
xor_value--;
|
||||
cfseek(PCXfile, 0, SEEK_SET);
|
||||
|
||||
bguy_data = (ubyte *)d_malloc(fsize);
|
||||
bguy_data1 = (ubyte *)d_malloc(fsize);
|
||||
|
||||
cfread(bguy_data1, 1, fsize, PCXfile);
|
||||
|
||||
for (i = 0; i < fsize; i++) {
|
||||
c = bguy_data1[fsize - i - 1] ^ xor_value;
|
||||
bguy_data[i] = c;
|
||||
xor_value--;
|
||||
}
|
||||
cfclose(PCXfile);
|
||||
d_free(bguy_data1);
|
||||
|
||||
p = bguy_data;
|
||||
memcpy( &header, p, sizeof(PCXHeader) );
|
||||
p += sizeof(PCXHeader);
|
||||
|
||||
// Is it a 256 color PCX file?
|
||||
if ((header.Manufacturer != 10)||(header.Encoding != 1)||(header.Nplanes != 1)||(header.BitsPerPixel != 8)||(header.Version != 5)) {
|
||||
d_free(bguy_data);
|
||||
return PCX_ERROR_WRONG_VERSION;
|
||||
}
|
||||
header.Xmin= INTEL_SHORT(header.Xmin);
|
||||
header.Xmax = INTEL_SHORT(header.Xmax);
|
||||
header.Ymin = INTEL_SHORT(header.Ymin);
|
||||
header.Ymax = INTEL_SHORT(header.Ymax);
|
||||
|
||||
// Find the size of the image
|
||||
xsize = header.Xmax - header.Xmin + 1;
|
||||
ysize = header.Ymax - header.Ymin + 1;
|
||||
|
||||
if ( bmp->bm_data == NULL ) {
|
||||
memset( bmp, 0, sizeof( grs_bitmap ) );
|
||||
bmp->bm_data = d_malloc( xsize * ysize );
|
||||
if ( bmp->bm_data == NULL ) {
|
||||
d_free(bguy_data);
|
||||
return PCX_ERROR_MEMORY;
|
||||
}
|
||||
bmp->bm_w = bmp->bm_rowsize = xsize;
|
||||
bmp->bm_h = ysize;
|
||||
bmp->bm_type = bitmap_type;
|
||||
}
|
||||
|
||||
for (row=0; row< ysize ; row++) {
|
||||
for (row=0; row< ysize ; row++) {
|
||||
pixdata = &bmp->bm_data[bmp->bm_rowsize*row];
|
||||
for (col=0; col< xsize ; ) {
|
||||
data = *p;
|
||||
p++;
|
||||
if ((data & 0xC0) == 0xC0) {
|
||||
count = data & 0x3F;
|
||||
data = *p;
|
||||
p++;
|
||||
memset( pixdata, data, count );
|
||||
pixdata += count;
|
||||
col += count;
|
||||
} else {
|
||||
*pixdata++ = data;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Read the extended palette at the end of PCX file
|
||||
// Read in a character which should be 12 to be extended palette file
|
||||
|
||||
p++;
|
||||
if (palette != NULL) {
|
||||
for (i = 0; i < 768; i++) {
|
||||
palette[i] = *p;
|
||||
palette[i] >>= 2;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
d_free(bguy_data);
|
||||
|
||||
return PCX_ERROR_NONE;
|
||||
}
|
||||
|
||||
int pcx_read_bitmap( char * filename, grs_bitmap * bmp,int bitmap_type ,ubyte * palette )
|
||||
{
|
||||
PCXHeader header;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
D1X-Rebirth Changelog
|
||||
|
||||
20080715
|
||||
--------
|
||||
2d/pcx.c, include/pcx.h, main/game.c, main/titles.c, main/titles.h: Add BALDGUY cheat for Mac data (see if anyone finds it ;-) )
|
||||
|
||||
20080701
|
||||
--------
|
||||
arch/carbon/conf.h, D1X.make, d1x-Info.plist, d1xgl-Info.plist, d1x-rebirth.xcodeproj, English.lproj/InfoPlist.strings: Increment version number for Mac, update MPW makefile, ensure Get Info strings copy to bundle, use correct Mac OS X SDKs
|
||||
|
|
|
@ -57,6 +57,10 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#define PCX_ERROR_WRITING 6
|
||||
#define PCX_ERROR_MEMORY 7
|
||||
|
||||
// Load bitmap for little-known 'baldguy' cheat.
|
||||
|
||||
extern int bald_guy_load( char * filename, grs_bitmap * bmp,int bitmap_type ,ubyte * palette );
|
||||
|
||||
// Reads filename into bitmap bmp, and fills in palette. If bmp->bm_data==NULL,
|
||||
// then bmp->bm_data is allocated and the w,h are filled.
|
||||
// If palette==NULL the palette isn't read in. Returns error code.
|
||||
|
|
|
@ -2123,6 +2123,7 @@ void FinalCheatsKey(int key)
|
|||
|
||||
john_cheat_func_3(key);
|
||||
john_cheat_func_4(key);
|
||||
bald_guy_cheat(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -504,6 +504,34 @@ int show_char_delay(char the_char, int delay, int robot_num, int cursor_flag)
|
|||
return w;
|
||||
}
|
||||
|
||||
ubyte baldguy_cheat = 0;
|
||||
static ubyte bald_guy_cheat_index = 0;
|
||||
char new_baldguy_pcx[] = "btexture.xxx";
|
||||
|
||||
#define BALD_GUY_CHEAT_SIZE 7
|
||||
#define NEW_END_GUY1 1
|
||||
#define NEW_END_GUY2 3
|
||||
|
||||
ubyte bald_guy_cheat_1[BALD_GUY_CHEAT_SIZE] = { KEY_B ^ 0xF0 ^ 0xab,
|
||||
KEY_A ^ 0xE0 ^ 0xab,
|
||||
KEY_L ^ 0xD0 ^ 0xab,
|
||||
KEY_D ^ 0xC0 ^ 0xab,
|
||||
KEY_G ^ 0xB0 ^ 0xab,
|
||||
KEY_U ^ 0xA0 ^ 0xab,
|
||||
KEY_Y ^ 0x90 ^ 0xab };
|
||||
|
||||
void bald_guy_cheat(int key)
|
||||
{
|
||||
if (key == (bald_guy_cheat_1[bald_guy_cheat_index] ^ (0xf0 - (bald_guy_cheat_index << 4)) ^ 0xab)) {
|
||||
bald_guy_cheat_index++;
|
||||
if (bald_guy_cheat_index == BALD_GUY_CHEAT_SIZE) {
|
||||
baldguy_cheat = 1;
|
||||
bald_guy_cheat_index = 0;
|
||||
}
|
||||
} else
|
||||
bald_guy_cheat_index = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// loads a briefing screen
|
||||
int load_briefing_screen( int screen_num )
|
||||
|
@ -515,6 +543,10 @@ int load_briefing_screen( int screen_num )
|
|||
|
||||
gr_init_bitmap_data(&briefing_bm);
|
||||
|
||||
if ( ((screen_num == NEW_END_GUY1) || (screen_num == NEW_END_GUY2)) && baldguy_cheat) {
|
||||
if ( bald_guy_load(new_baldguy_pcx, &briefing_bm, BM_LINEAR, gr_palette) == 0)
|
||||
return 0;
|
||||
}
|
||||
if ((pcx_error=pcx_read_bitmap( Briefing_screens_LH[screen_num].bs_name, &briefing_bm, BM_LINEAR, gr_palette ))!=PCX_ERROR_NONE) {
|
||||
Int3();
|
||||
return 0;
|
||||
|
@ -1161,3 +1193,4 @@ void do_end_game(void)
|
|||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,5 +25,6 @@ extern void do_briefing_screens(int level_num);
|
|||
extern void do_end_game(void);
|
||||
extern char * get_briefing_screen( int level_num );
|
||||
extern void show_order_form(void);
|
||||
extern void bald_guy_cheat(int key);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue