Пример #1
0
//-------------------------------------------------------------------------
// ShowSystem()
//-------------------------------------------------------------------------
void ShowSystem()
{
	char avail[2][8]={"None","Present"};

	MM_Startup ();
	CA_Startup ();
	IN_Startup ();
	PM_Startup ();
	SD_Startup ();

	fprint(show_text1);
	fprint(show_text2);
	fprint(show_text3);

	fprint(show_text5);

	printf("        Mouse: %s\n",avail[MousePresent]);
	printf("     Joystick: %s\n",avail[JoysPresent[0]||JoysPresent[1]]);
	printf("        AdLib: %s\n",avail[AdLibPresent&&!SoundBlasterPresent]);
	printf("Sound Blaster: %s\n",avail[SoundBlasterPresent]);
	printf(" Sound Source: %s\n\n",avail[SoundSourcePresent]);
	fprint(show_text2);

	SD_Shutdown ();
	PM_Shutdown ();
	IN_Shutdown ();
	CA_Shutdown ();
	MM_Shutdown ();
}
Пример #2
0
void InitGame (void)
{
	//id0_unsigned_t	segstart,seglength;
	id0_int_t			i,x,y;
	id0_unsigned_t	*blockstart;

	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		US_TextScreen();
	}

	MM_Startup ();
	VW_Startup ();
#ifndef PROFILE
	IN_Startup ();
	SD_Startup ();
#endif
	US_Startup ();
	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		US_UpdateTextScreen();
	}
	CA_Startup ();
	US_Setup ();

	US_SetLoadSaveHooks(LoadTheGame,SaveTheGame,ResetGame);

//
// load in and lock down some basic chunks
//

	CA_ClearMarks ();

	CA_MarkGrChunk(STARTFONT);
	CA_MarkGrChunk(STARTTILE8);
	CA_MarkGrChunk(STARTTILE8M);
	CA_MarkGrChunk(HAND1PICM);
	CA_MarkGrChunk(HAND2PICM);
	CA_MarkGrChunk(ENTERPLAQUEPIC);

	CA_CacheMarks (NULL);

	MM_SetLock (&grsegs[STARTFONT],true);
	MM_SetLock (&grsegs[STARTTILE8],true);
	MM_SetLock (&grsegs[STARTTILE8M],true);
	MM_SetLock (&grsegs[HAND1PICM],true);
	MM_SetLock (&grsegs[HAND2PICM],true);
	MM_SetLock (&grsegs[ENTERPLAQUEPIC],true);

	fontcolor = WHITE;


//
// build some tables
//
	for (i=0;i<MAPSIZE;i++)
		nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;

	for (i=0;i<PORTTILESHIGH;i++)
		uwidthtable[i] = UPDATEWIDE*i;

	blockstart = &blockstarts[0];
	for (y=0;y<UPDATEHIGH;y++)
		for (x=0;x<UPDATEWIDE;x++)
			*blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;

	BuildTables ();			// 3-d tables

	SetupScaling ();

#ifndef PROFILE
	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		US_FinishTextScreen();
	}
#endif

//
// reclaim the memory from the linked in text screen
//
	// REFKEEN DIFFERENCE (FIXME: Should we "fix" this at all?)
	// - Don't handle this, a bit more complicated with our setup and the
	// difference is (probably) insignificant with well-defined behaviors
	// anyway...
#if 0
	segstart = FP_SEG(&introscn);
	seglength = 4000/16;
	if (FP_OFF(&introscn))
	{
		segstart++;
		seglength--;
	}

	MML_UseSpace (segstart,seglength);
#endif

	VW_SetScreenMode (GRMODE);
	VW_ColorBorder (3);
	VW_ClearVideo (BLACK);

//
// initialize variables
//
	updateptr = &update[0];
	// REFKEEN - Safe unaligned accesses
	*(updateptr + UPDATEWIDE*PORTTILESHIGH) = 1;
	*(updateptr + UPDATEWIDE*PORTTILESHIGH + 1) = 3;
	//*(id0_unsigned_t *)(updateptr + UPDATEWIDE*PORTTILESHIGH) = UPDATETERMINATE;
	bufferofs = 0;
	displayofs = 0;
	VW_SetLineWidth(SCREENWIDTH);
}
Пример #3
0
int main(int argc, char *argv[])
{
	if (argc != 4)
	{
		printf("Action validator - Usage:\n");
		printf("%s <UNPACKED.EXE> <ACTION.EXT> <EPISODENUM>\n", argv[0]);
		return 0;
	}


	switch (atoi(argv[3]))
	{
	case 4:
		ck_currentEpisode = &ck4_episode;
		break;
	case 5:
		ck_currentEpisode = &ck5_episode;
		break;
	case 6:
		ck_currentEpisode = &ck6_episode;
		break;
	default:
		fprintf(stderr, "Invalid episode selected - only 4 or 5 is valid!\n");
		return 1;
	}

	FILE *exeFp = fopen(argv[1], "rb");
	if (exeFp == NULL)
	{
		fprintf(stderr, "Couldn't open DOS EXE file! %s:\n", argv[1]);
		return 1;
	}
	fseek(exeFp, 0L, SEEK_END);
	long int fSize = ftell(exeFp);
	fseek(exeFp, 0L, SEEK_SET);

	char *fileBuffer = (char *)malloc(fSize);
	if (!fileBuffer)
	{
		fprintf(stderr, "Couldn't allocate memory for DOS EXE!\n");
		fclose(exeFp);
		return 1;
	}

	fread(fileBuffer, fSize, 1, exeFp);
	fclose(exeFp);

	// We need this here
	MM_Startup();

	// Compile the actions
	CK_ACT_SetupFunctions();
	CK_KeenSetupFunctions();
	CK_OBJ_SetupFunctions();
	CK_Map_SetupFunctions();
	CK_Misc_SetupFunctions();
	ck_currentEpisode->setupFunctions();
	CK_ACT_LoadActions(argv[2]);

	char *exeImage = fileBuffer + 16 * (*(uint16_t *)(fileBuffer + 8));
	char *dsegBuffer = exeImage + 16 * (*(uint16_t *)(exeImage + 1)); // HUGE HACK for fetching dseg

	// HACK
	extern STR_Table *ck_actionTable;
	for (int i = 0, count = 0; i < ck_actionTable->size; ++i)
	{
		if (ck_actionTable->arr[i].str == NULL)
			continue;

		const char *name = ck_actionTable->arr[i].str;
		CK_action *act = (CK_action *)(ck_actionTable->arr[i].ptr);

		char *dataToCompare = &dsegBuffer[act->compatDosPointer];
		if (*(int16_t *)dataToCompare != act->chunkLeft)
			printf("chunkLeft mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+2) != act->chunkRight)
			printf("chunkRight mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+4) != act->type)
			printf("type mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+6) != act->protectAnimation)
			printf("protectAnimation mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+8) != act->stickToGround)
			printf("stickToGround mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+10) != act->timer)
			printf("timer mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+12) != act->velX)
			printf("velX mismatch found for action no. %d: %s\n", count, name);
		if (*(int16_t *)(dataToCompare+14) != act->velY)
			printf("velY mismatch found for action no. %d: %s\n", count, name);
		if (!compareFunctionDOSPtrToNativePtr(*(uint32_t *)(dataToCompare+16), (void *)(act->think)))
			printf("think mismatch found (possibly) for action no. %d: %s\n", count, name);
		if (!compareFunctionDOSPtrToNativePtr(*(uint32_t *)(dataToCompare+20), (void *)(act->collide)))
			printf("collide mismatch found (possibly) for action no. %d: %s\n", count, name);
		if (!compareFunctionDOSPtrToNativePtr(*(uint32_t *)(dataToCompare+24), (void *)(act->draw)))
			printf("draw mismatch found (possibly) for action no. %d: %s\n", count, name);
		if (((act->next == NULL) && (*(uint16_t *)(dataToCompare+28) != 0)) ||
		    ((act->next != NULL) && (*(uint16_t *)(dataToCompare+28) != act->next->compatDosPointer))
		)
			printf("next mismatch found for action no. %d: %s\n", count, name);

		++count;
	}
	return 0;
}
Пример #4
0
void CK_InitGame()
{
	// Can't do much without memory!
	MM_Startup();

	//TODO: Get filenames/etc from config/episode

	// Load the core datafiles
	CA_Startup();
	// Setup saved games handling
	US_Setup();

	// Set a few Menu Callbacks
	// TODO: Finish this!
	US_SetMenuFunctionPointers(&CK_LoadGame, &CK_SaveGame, &CK_ExitMenu);
	// Set ID engine Callbacks
	ca_beginCacheBox = CK_BeginCacheBox;
	ca_updateCacheBox = CK_UpdateCacheBox;
	ca_finishCacheBox = CK_FinishCacheBox;

	// Mark some chunks we'll need.
	CA_ClearMarks();
	CA_MarkGrChunk(FON_MAINFONT);
	CA_MarkGrChunk(ca_gfxInfoE.offTiles8);
	CA_MarkGrChunk(ca_gfxInfoE.offTiles8m);
	CA_MarkGrChunk(MPIC_STATUSLEFT);
	CA_MarkGrChunk(MPIC_STATUSRIGHT);
	CA_MarkGrChunk(PIC_TITLESCREEN); // Moved from CA_Startup
	CA_CacheMarks(0);

	// Lock them chunks in memory.
	CA_LockGrChunk(FON_MAINFONT);
	MM_SetLock(&ca_graphChunks[ca_gfxInfoE.offTiles8], true);
	MM_SetLock(&ca_graphChunks[ca_gfxInfoE.offTiles8m], true);
	MM_SetLock(&ca_graphChunks[MPIC_STATUSLEFT], true);
	MM_SetLock(&ca_graphChunks[MPIC_STATUSRIGHT], true);

	// Compile the actions
	CK_ACT_SetupFunctions();
	CK_KeenSetupFunctions();
	CK_OBJ_SetupFunctions();
	CK_Map_SetupFunctions();
	CK_Misc_SetupFunctions();
	ck_currentEpisode->setupFunctions();
	CK_ACT_LoadActions("ACTION.EXT");

	// Setup the screen
	VL_InitScreen();
	// TODO: Palette initialization should be done in the terminator code
	VL_SetDefaultPalette();


	// Setup input
	IN_Startup();

	// Setup audio
	SD_Startup();

	US_Startup();

	// Wolf loads fonts here, but we do it in CA_Startup()?

	RF_Startup();

	VL_ColorBorder(3);
	VL_ClearScreen(0);
	VL_Present();

	// Create a surface for the dropdown menu
	ck_statusSurface = VL_CreateSurface(STATUS_W+64, STATUS_H+16);
}
void InitGame()
{
    MM_Startup();

    id0_int_t i;

/*#if 0
    // Handle piracy screen...
    //
    movedata(FP_SEG(PIRACY),(id0_unsigned_t)PIRACY,0xb800,displayofs,4000);
    while (BE_ST_BiosScanCode(0) != sc_Return);
    //while ((bioskey(0)>>8) != sc_Return);
#endif*/

#if GRMODE == EGAGR
    if (mminfo.mainmem < 335l*1024)
    {
//#pragma warn    -pro
//#pragma warn    -nod
#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
        BE_ST_textcolor(7);
#endif
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
        if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
        {
            BE_ST_textbackground(0);
        }
//#pragma warn    +nod
//#pragma warn    +pro
        BE_ST_clrscr();                       // we can't include CONIO because of a name conflict
//#pragma warn    +nod
//#pragma warn    +pro
        BE_ST_puts ("There is not enough memory available to play the game reliably.  You can");
        BE_ST_puts ("play anyway, but an out of memory condition will eventually pop up.  The");
        BE_ST_puts ("correct solution is to unload some TSRs or rename your CONFIG.SYS and");
        BE_ST_puts ("AUTOEXEC.BAT to free up more memory.\n");
        BE_ST_puts ("Do you want to (Q)uit, or (C)ontinue?");
        //i = bioskey (0);
        //if ( (i>>8) != sc_C)
        i = BE_ST_BiosScanCode (0);
        if (i != sc_C)
            Quit ("");
    }
#endif

    US_TextScreen();

    VW_Startup ();
    RF_Startup ();
    IN_Startup ();
    SD_Startup ();
    US_Startup ();

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
    US_UpdateTextScreen();
#endif

    CA_Startup ();
    US_Setup ();

//
// load in and lock down some basic chunks
//

    CA_ClearMarks ();

    CA_MarkGrChunk(STARTFONT);
    CA_MarkGrChunk(STARTFONTM);
    CA_MarkGrChunk(STARTTILE8);
    CA_MarkGrChunk(STARTTILE8M);
    for ( id0_int_t j=KEEN_LUMP_START ; j<=KEEN_LUMP_END ; j++)
    {
        CA_MarkGrChunk(j);
    }

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
    CA_CacheMarks (NULL);
#elif defined REFKEEN_VER_KDREAMS_ANYEGA_ALL
    CA_CacheMarks (NULL, 0);
#endif

    MM_SetLock (&grsegs[STARTFONT],true);
    MM_SetLock (&grsegs[STARTFONTM],true);
    MM_SetLock (&grsegs[STARTTILE8],true);
    MM_SetLock (&grsegs[STARTTILE8M],true);
    for ( id0_int_t j=KEEN_LUMP_START ; j<=KEEN_LUMP_END ; j++)
    {
        MM_SetLock (&grsegs[j],true);
    }

    setupAudio();

    fontcolor = WHITE;

    RefKeen_FillObjStatesWithDOSPointers(); // Saved games compatibility

    US_FinishTextScreen();
}
Пример #6
0
void InitGame (void)
{
	//id0_unsigned_t	segstart,seglength;
	id0_int_t			i,x,y;
	id0_unsigned_t	*blockstart;

//	US_TextScreen();

	MM_Startup ();
	VW_Startup ();
#ifndef PROFILE
	IN_Startup ();
	SD_Startup ();
#endif
	US_Startup ();

	CA_Startup ();

	US_Setup ();

	US_SetLoadSaveHooks(LoadTheGame,SaveTheGame,ResetGame);


//
// load in and lock down some basic chunks
//

	CA_ClearMarks ();

	CA_MarkGrChunk(STARTFONT);
	CA_MarkGrChunk(STARTTILE8);
	CA_MarkGrChunk(STARTTILE8M);
	CA_MarkGrChunk(HAND1PICM);

	CA_MarkGrChunk(NORTHICONSPR);
	CA_CacheMarks (NULL);

	MM_SetLock (&grsegs[STARTFONT],true);
	MM_SetLock (&grsegs[STARTTILE8],true);
	MM_SetLock (&grsegs[STARTTILE8M],true);
	MM_SetLock (&grsegs[HAND1PICM],true);

	fontcolor = WHITE;


//
// build some tables
//
	for (i=0;i<MAPSIZE;i++)
		nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;

	for (i=0;i<PORTTILESHIGH;i++)
		uwidthtable[i] = UPDATEWIDE*i;

	blockstart = &blockstarts[0];
	for (y=0;y<UPDATEHIGH;y++)
		for (x=0;x<UPDATEWIDE;x++)
			*blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;

	BuildTables ();			// 3-d tables

	SetupScaling ();

#ifndef PROFILE
//	US_FinishTextScreen();
#endif

#if 0
//
// reclaim the memory from the linked in text screen
//
	segstart = FP_SEG(&introscn);
	seglength = 4000/16;
	if (FP_OFF(&introscn))
	{
		segstart++;
		seglength--;
	}
	MML_UseSpace (segstart,seglength);
#endif

	VW_SetScreenMode (GRMODE);
	ge_textmode = false;
//	VW_ColorBorder (3);
	VW_ClearVideo (BLACK);

//
// initialize variables
//
	updateptr = &update[0];
	// REFKEEN - Safe unaligned accesses
	*(updateptr + UPDATEWIDE*PORTTILESHIGH) = 1;
	*(updateptr + UPDATEWIDE*PORTTILESHIGH + 1) = 3;
	//*(id0_unsigned_t *)(updateptr + UPDATEWIDE*PORTTILESHIGH) = UPDATETERMINATE;
	bufferofs = 0;
	displayofs = 0;
	VW_SetLineWidth(SCREENWIDTH);
}
Пример #7
0
//------------------------------------------------------------------------
// InitGame()
//------------------------------------------------------------------------
void InitGame (void)
{
	Sint16                     i,x,y;
	Uint16        *blockstart;
//long mmsize;

	MM_Startup ();                  // so the signon screen can be freed
#if IN_DEVELOPMENT || GEORGE_CHEAT || SHOW_CHECKSUM
	if (MS_CheckParm("checksum"))
	{
		ShowChecksums();
		MM_Shutdown();
		exit(0);
	}
#endif
	CA_Startup ();

// Any problems with this version of the game?
//
#if IN_DEVELOPMENT || TECH_SUPPORT_VERSION
	if (!MS_CheckParm("nochex"))
#endif

#if !SKIP_CHECKSUMS
		CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM);

#if GAME_VERSION != SHAREWARE_VERSION
	if (ChecksumFile("FILE_ID.DIZ",0) != DIZFILE_CHECKSUM)
		gamestate.flags |= GS_BAD_DIZ_FILE;
#endif
#endif

	VL_SetVGAPlaneMode ();
	VL_SetPalette (0,256,vgapal);

	VW_Startup ();
	IN_Startup ();
	PM_Startup ();
	SD_Startup ();
	US_Startup ();

	if (CheckForSpecialCode(POWERBALLTEXT))
#if IN_DEVELOPMENT
		DebugOk = true;
#else
		PowerBall = true;
#endif

	if (CheckForSpecialCode(TICSTEXT))
		gamestate.flags |= GS_TICS_FOR_SCORE;

	if (CheckForSpecialCode(MUSICTEXT))
		gamestate.flags |= GS_MUSIC_TEST;

	if (CheckForSpecialCode(RADARTEXT))
		gamestate.flags |= GS_SHOW_OVERHEAD;

#if IN_DEVELOPMENT
	//
	// Clear Monocrome
	//
	_fmemset(MK_FP(0xb000,0x0000),0,4000);
#endif

//
// build some tables
//
	InitDigiMap ();

	for (i=0;i<MAPSIZE;i++)
	{
		nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;
		farmapylookup[i] = i*64;
	}

	for (i=0;i<PORTTILESHIGH;i++)
		uwidthtable[i] = UPDATEWIDE*i;

	blockstart = &blockstarts[0];
	for (y=0;y<UPDATEHIGH;y++)
		for (x=0;x<UPDATEWIDE;x++)
			*blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;

	updateptr = &update[0];

	bufferofs = 0;
	displayofs = 0;
	ReadConfig ();

//
// draw intro screen stuff
//
//	if (!(gamestate.flags & GS_QUICKRUN))
//		IntroScreen ();

//
// load in and lock down some basic chunks
//

	LoadFonts();

	LoadLatchMem ();
	BuildTables ();          // trig tables
	SetupWalls ();
	NewViewSize ();

//
// initialize variables
//
	InitRedShifts ();
}