Exemplo n.º 1
0
///////////////////////////////////////////////////////////////////////////
//
//      US_FinishTextScreen() - After the main program has finished its initial
//              loading, this routine waits for a keypress and then clears the screen
//
///////////////////////////////////////////////////////////////////////////
void
US_FinishTextScreen(void)
{
static  byte    colors[] = {4,6,13,15,15,15,15,15,15};
		boolean up;
		int             i,c;

	// Change Loading... to Press a Key

	if (!(tedlevel || NoWait))
	{
		IN_ClearKeysDown();
		for (i = 0,up = true;!IN_UserInput(4,true);)
		{
			c = colors[i];
			if (up)
			{
				if (++i == 9)
					i = 8,up = false;
			}
			else
			{
				if (--i < 0)
					i = 1,up = true;
			}

			USL_ScreenDraw(29,22," Ready - Press a Key     ",0x00 + c);
		}
	}
	else
		USL_ScreenDraw(29,22," Ready - Press a Key     ",0x9a);
	IN_ClearKeysDown();

	USL_ClearTextScreen();
}
Exemplo n.º 2
0
//
// END ARTICLES
//
void EndText (void)
{
	int			artnum;
	char 	*text;
	memptr		layout;


	ClearMemory ();

	CA_UpLevel ();
	MM_SortMem ();
#ifdef JAPAN
	ShowArticle(gamestate.episode + 1);

	VW_FadeOut();

	SETFONTCOLOR(0,15);
	IN_ClearKeysDown();
	if (MousePresent)
		Mouse(MDelta);	// Clear accumulated mouse movement

	FreeMusic ();
	CA_DownLevel ();
	MM_SortMem ();
#else



#ifdef ARTSEXTERN
	artnum = endextern+gamestate.episode;
	CA_CacheGrChunk (artnum);
	text = (char *)grsegs[artnum];
	MM_SetLock (&grsegs[artnum], True);
#else
	endfilename[6] = '1'+gamestate.episode;
	CA_LoadFile (endfilename,&layout);
	text = (char *)layout;
	MM_SetLock (&layout, True);
#endif

	ShowArticle (text);

#ifdef ARTSEXTERN
	MM_FreePtr (&grsegs[artnum]);
#else
	MM_FreePtr (&layout);
#endif


	VW_FadeOut();
	SETFONTCOLOR(0,15);
	IN_ClearKeysDown();
	//if (MousePresent) // PORT
	//	Mouse(MDelta);	// Clear accumulated mouse movement

	//FreeMusic (); 
	CA_DownLevel ();
	MM_SortMem ();
#endif
}
Exemplo n.º 3
0
static bool ShowText(const FString exitText, const FString flat, const FString music, ClusterInfo::ExitType type)
{
    // Use cluster background if set.
    if(!flat.IsEmpty())
        backgroundFlat = TexMan(flat);
    if(!backgroundFlat) // Get default if needed
        backgroundFlat = TexMan(gameinfo.FinaleFlat);

    switch(type)
    {
    case ClusterInfo::EXIT_MESSAGE:
        SD_PlaySound ("misc/1up");

        Message (exitText);

        IN_ClearKeysDown ();
        IN_Ack ();
        return false;

    case ClusterInfo::EXIT_LUMP:
    {
        int lumpNum = Wads.CheckNumForName(exitText, ns_global);
        if(lumpNum != -1)
        {
            FWadLump lump = Wads.OpenLumpNum(lumpNum);
            char* text = new char[Wads.LumpLength(lumpNum)];
            lump.Read(text, Wads.LumpLength(lumpNum));

            if(!music.IsEmpty())
                StartCPMusic(music);
            ShowArticle(text, !!(IWad::GetGame().Flags & IWad::HELPHACK));

            delete[] text;
        }

        break;
    }

    default:
        if(!music.IsEmpty())
            StartCPMusic(music);
        ShowArticle(exitText, !!(IWad::GetGame().Flags & IWad::HELPHACK));
        break;
    }

    IN_ClearKeysDown();
    if (MousePresent && IN_IsInputGrabbed())
        IN_CenterMouse();  // Clear accumulated mouse movement
    return true;
}
Exemplo n.º 4
0
void CK6_GrabbiterCol(CK_object *a, CK_object *b)
{
  if (!ck_gameState.ep.ck6.sandwich)
  {
    CA_CacheGrChunk(0x23);
    SD_PlaySound(SOUND_GRABBITER);

    US_CenterWindow(26, 8);
    VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
    US_SetWindowW(US_GetWindowW() - 0x30);
    US_SetPrintY(US_GetPrintY() + 5);
    US_CPrint("Oh no!\n"
        "It's a slavering\n"
        "Grabbiter! He says,\n"
        "\"Get me lunch and\n"
        "I'll tell ya a secret!\"");
    VL_Present();
    VL_DelayTics(30); // VW_WaitVBL(30);
    IN_ClearKeysDown();
    IN_WaitButton();
    RF_ForceRefresh();
    ck_nextX = -b->deltaPosX;
    ck_nextY = -b->deltaPosY;
    b->xDirection = b->yDirection = IN_motion_None;
    CK_PhysUpdateNormalObj(b);
  }
  else
  {
    ck_gameState.ep.ck6.sandwich++;
    CA_CacheGrChunk(0x23);
    US_CenterWindow(26, 8);
    VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
    US_SetWindowW(US_GetWindowW() - 0x30);
    US_SetPrintY(US_GetPrintY() + 2);
    US_CPrint("The Grabbiter grabs\n"
        "the gigantic sandwich,\n"
        "downs it in one bite,\n"
        "and says,\"Here's your\n"
        "secret. Big meals\n"
        "make me sleepy!\n");
    VL_Present();
    VL_DelayTics(30); // VW_WaitVBL(30);
    IN_ClearKeysDown();
    IN_WaitButton();
    CK_SetAction2(a, CK_GetActionByName("CK6_ACT_GrabbiterNapping0"));
    RF_ForceRefresh();
  }
}
Exemplo n.º 5
0
DreamsIntro::DreamsIntro()
{
    mStep = 1;
    mTimer = TickBase * 4;

    VW_SetScreenMode (GRMODE);
    VW_ClearVideo (BLACK);

    US_SetLoadSaveHooks(LoadGame,SaveGame,ResetGame);
    restartgame = gd_Continue;

    //while (true)
    //{

        loadedgame = false;

        mFileName1 = "TITLESCR.LBM";
        if (LoadLIBShape("KDREAMS.CMP", mFileName1.c_str(), &mFileShape1))
        {
            //Quit("Can't load TITLE SCREEN");
        }

        //while (!restartgame && !loadedgame)


    VW_InitDoubleBuffer();
    IN_ClearKeysDown();

    VW_SetScreen(0, 0);
    MoveGfxDst(0, 200);
    UnpackEGAShapeToScreen(&mFileShape1, 0, 0);
    mTimer = TickBase * 4;

}
Exemplo n.º 6
0
//
// END ARTICLES
//
void EndText()
{
	int artnum;
	const char *text;

	ClearMemory();

	artnum = endextern+gamestate.episode;
	CA_CacheGrChunk(artnum);
	if (w0 == true){
		text = (const char *)grsegsWL1[artnum];
	} else if (w1 == true){
		text = (const char *)grsegsWL6[artnum];
	} else if (s0 == true){
		text = (const char *)grsegsSDM[artnum];
	} else {
		text = (const char *)grsegsSOD[artnum];
	}

	ShowArticle(text);

	CA_UnCacheGrChunk(artnum);
	
	VW_FadeOut();
	SETFONTCOLOR(0,15);
	IN_ClearKeysDown();

	IN_GetMouseDelta(NULL, NULL); // Clear accumulated mouse movement
	
	FreeMusic();
}
Exemplo n.º 7
0
//--------------------------------------------------------------------------
// PopupAutoMap()
//--------------------------------------------------------------------------
void PopupAutoMap()
{
	#define BASE_X	64
	#define BASE_Y	44

	ThreeDRefresh();
	ThreeDRefresh();

	SD_StopSound();
	ClearMemory();
	CacheDrawPic(BASE_X,BASE_Y,AUTOMAPPIC);

	ShowStats(BASE_X+101,BASE_Y+22,ss_quick,&gamestuff.level[gamestate.mapon].stats);

	while (Keyboard[sc_back_quote])
		CalcTics();

#if GAME_VERSION != SHAREWARE_VERSION && IN_DEVELOPMENT
//	if (DebugOk && PP_step)
//		PicturePause();
#endif

	IN_StartAck ();
	while (!IN_CheckAck ())
		CalcTics();

	CleanDrawPlayBorder();
	IN_ClearKeysDown();
}
Exemplo n.º 8
0
void DreamsEngine::pumpEvent(const CEvent *evPtr)
{
    GameEngine::pumpEvent(evPtr);

    if( dynamic_cast<const FinishedLoadingResources*>(evPtr) )
    {
        mResourcesLoaded = true;
    }

    if( dynamic_cast<const SwitchToIntro*>(evPtr) )
    {
        mpScene.reset( new DreamsIntro );
        gGameStateChange = GSS_NONE;
    }


    if( dynamic_cast<const LaunchControlPanel*>(evPtr) )
    {
        mpScene.reset( new DreamsControlPanel );
        mpScene->start();
        gGameStateChange = GSS_NONE;
        gInput.flushAll();
        IN_ClearKeysDown();
    }   
    if( dynamic_cast<const SwitchToGamePlay*>(evPtr) )
    {
        mpScene.reset( new DreamsGamePlay );
        mpScene->start();
        gGameStateChange = GSS_NONE;
        gInput.flushAll();
        IN_ClearKeysDown();
    }
    /*if( dynamic_cast<const NullifyScene*>(evPtr) )
    {
        mpScene = nullptr;
        gGameStateChange = GSS_NONE;
        gInput.flushAll();
        IN_ClearKeysDown();
    }*/

    if(mpScene)
    {
        mpScene->pumpEvent(evPtr);
    }
}
Exemplo n.º 9
0
void ViewMap (void)
{
	id0_boolean_t		button0held;

	viewtype = actoratview;
	button0held = false;


	maporgx = player->tilex - VIEWTILEX/2;
	if (maporgx<0)
		maporgx = 0;
	maporgy = player->tiley - VIEWTILEY/2;
	if (maporgy<0)
		maporgy = 0;

	do
	{
//
// let user pan around
//
		IN_ReadControl(0,&control);
		if (control.xaxis == -1 && maporgx>0)
			maporgx--;
		if (control.xaxis == 1 && maporgx<mapwidth-VIEWTILEX)
			maporgx++;
		if (control.yaxis == -1 && maporgy>0)
			maporgy--;
		if (control.yaxis == 1 && maporgy<mapheight-VIEWTILEY)
			maporgy++;

		if (control.button0 && !button0held)
		{
			button0held = true;
			// REFKEEN - Make this C++ friendly
			if (viewtype == lastview-1)
				viewtype = mapview;
			else
				viewtype = (viewtypeenum)(viewtype + 1);
#if 0
			viewtype++;
			if (viewtype==lastview)
				viewtype = mapview;
#endif
		}
		if (!control.button0)
			button0held = false;


		OverheadRefresh ();

		BE_ST_ShortSleep();

	} while (!Keyboard[sc_Escape]);

	IN_ClearKeysDown ();
	DrawPlayScreen ();
}
Exemplo n.º 10
0
void CK6_MapCliffCol(CK_object *a, CK_object *b)
{
  if (b->type == CT_Player)
  {
    if (ck_gameState.ep.ck6.rope == 0)
    {
      CA_CacheGrChunk(0x23);

      US_CenterWindow(26, 8);
      VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
      US_SetWindowW(US_GetWindowW() - 0x30);
      US_SetPrintY(US_GetPrintY() + 15);
      US_CPrint("What a tall cliff!\n"
                "Wish I had a rope\n"
                "and grappling hook.\n");
      VL_Present();
      SD_PlaySound(SOUND_NEEDKEYCARD);
      VL_DelayTics(30); // VW_WaitVBL(30);
      IN_ClearKeysDown();
      IN_WaitButton();
      RF_ForceRefresh();
      ck_nextX = -b->deltaPosX;
      ck_nextY = -b->deltaPosY;
      b->xDirection = b->yDirection = IN_motion_None;
      CK_PhysUpdateNormalObj(b);

    }
    else if (ck_gameState.ep.ck6.rope == 1)
    {
      ck_gameState.ep.ck6.rope++;
      SD_PlaySound(SOUND_KEENTHROWROPE);
      CK_SetAction2(b, CK_GetActionByName("CK6_ACT_MapKeenThrowRope0"));
      b->type = CT_Friendly;
    }
    else if (ck_gameState.ep.ck6.rope == 2)
    {
      if (a->user1)
      {
        b->posY += 0x40;
        b->user4 = 6;
        b->yDirection = IN_motion_Down;
      }
      else
      {
        b->posY -= 0x40;
        b->user4 = 6;
        b->yDirection = IN_motion_Up;
      }

      CK_SetAction(b, CK_GetActionByName("CK6_ACT_MapKeenClimbRope0"));
      b->type = CT_Friendly;
    }
  }
}
Exemplo n.º 11
0
void EndScreen (int palette, int screen)
{
	CA_CacheScreen (screen);
	VW_UpdateScreen ();
	CA_CacheGrChunk (palette);
	VL_FadeIn(0,255,grsegs[palette],30);
	UNCACHEGRCHUNK (palette);
	IN_ClearKeysDown ();
	IN_Ack ();
	VW_FadeOut ();
}
Exemplo n.º 12
0
void ViewMap (void)
{
    boolean         button0held;

    viewtype = actoratview;
    //      button0held = false;


    maporgx = player->tilex - VIEWTILEX/2;
    if (maporgx<0)
        maporgx = 0;
    if (maporgx>MAPSIZE-VIEWTILEX)
        maporgx=MAPSIZE-VIEWTILEX;
    maporgy = player->tiley - VIEWTILEY/2;
    if (maporgy<0)
        maporgy = 0;
    if (maporgy>MAPSIZE-VIEWTILEY)
        maporgy=MAPSIZE-VIEWTILEY;

    do
    {
        //
        // let user pan around
        //
        PollControls ();
        if (controlx < 0 && maporgx>0)
            maporgx--;
        if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
            maporgx++;
        if (controly < 0 && maporgy>0)
            maporgy--;
        if (controly > 0 && maporgy<mapheight-VIEWTILEY)
            maporgy++;

#if 0
        if (c.button0 && !button0held)
        {
            button0held = true;
            viewtype++;
            if (viewtype>visview)
                viewtype = mapview;
        }
        if (!c.button0)
            button0held = false;
#endif

        OverheadRefresh ();

    } while (!Keyboard[sc_Escape]);

    IN_ClearKeysDown ();
}
Exemplo n.º 13
0
static bool WaitIntermission(unsigned int time)
{
	if(time)
	{
		return IN_UserInput(time);
	}
	else
	{
		IN_ClearKeysDown ();
		IN_Ack ();
		return true;
	}
}
Exemplo n.º 14
0
void
GameOver (void)
{
	VW_InitDoubleBuffer ();
	US_CenterWindow (16,3);

	US_PrintCentered("Game Over!");

	VW_UpdateScreen ();
	IN_ClearKeysDown ();
	IN_Ack ();

}
Exemplo n.º 15
0
void
EndScreen (int palette, int screen)
{
    SDL_Color pal[256];
    CA_CacheScreen (screen);
    VW_UpdateScreen ();
    CA_CacheGrChunk (palette);
    VL_ConvertPalette(grsegs[palette], pal, 256);
    VL_FadeIn (0, 255, pal, 30);
    UNCACHEGRCHUNK (palette);
    IN_ClearKeysDown ();
    IN_Ack ();
    VW_FadeOut ();
}
Exemplo n.º 16
0
id0_int_t WaitOrKey (id0_int_t vbls)
{
	while (vbls--)
	{
		IN_ReadControl(0,&c);           // get player input
		if (LastScan || c.button0 || c.button1)
		{
			IN_ClearKeysDown ();
			return 1;
		}
		VW_WaitVBL(1);
	}
	return 0;
}
Exemplo n.º 17
0
void ViewMap (void)
{
	boolean		button0held;

	viewtype = actoratview;
	button0held = false;


	maporgx = player->tilex - VIEWTILEX/2;
	if (maporgx<0)
		maporgx = 0;
	maporgy = player->tiley - VIEWTILEY/2;
	if (maporgy<0)
		maporgy = 0;

	do
	{
//
// let user pan around
//
		IN_ReadControl(0,&control);
		if (control.xaxis == -1 && maporgx>0)
			maporgx--;
		if (control.xaxis == 1 && maporgx<mapwidth-VIEWTILEX)
			maporgx++;
		if (control.yaxis == -1 && maporgy>0)
			maporgy--;
		if (control.yaxis == 1 && maporgy<mapheight-VIEWTILEY)
			maporgy++;

		if (control.button0 && !button0held)
		{
			button0held = true;
			viewtype++;
			if (viewtype==lastview)
				viewtype = mapview;
		}
		if (!control.button0)
			button0held = false;


		OverheadRefresh ();

	} while (!Keyboard[sc_Escape]);

	IN_ClearKeysDown ();
	DrawPlayScreen ();
}
Exemplo n.º 18
0
void T_Gate (objtype *ob)
{
	id0_int_t	spot;
	objtype *check;
	id0_unsigned_t	temp;

	if (CheckHandAttack (ob) && !playstate)
	{
	//
	// warp
	//
		temp = bufferofs;
		bufferofs = 0;
		VW_Bar (26,4,232,9,STATUSCOLOR);		// clear text description
		bufferofs = temp;
		IN_ClearKeysDown ();
		if (ob->temp1)
		{
		//
		// teleport inside level
		//
			for (check=player->next;check;check=check->next)
				if (check->obclass==gateobj && check->temp1==ob->temp1 &&
					check != ob)
				{
					player->x = check->x;
					player->y = check->y;
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					fizzlein=true;
				}
		}
		else
		{
		//
		// teleport out of level
		//
			playstate = ex_warped;
			spot = *(mapsegs[0]+farmapylookup[ob->tiley]+ob->tilex)-NAMESTART;
			if (spot<1)
				gamestate.mapon++;
			else
				gamestate.mapon=spot-1;
			SD_PlaySound(WARPUPSND);
		}
	}
}
Exemplo n.º 19
0
//--------------------------------------------------------------------------
// ShowQuickInstructions()
//--------------------------------------------------------------------------
void ShowQuickInstructions()
{
	ShowQuickMsg=false;

	if ((demoplayback) || (gamestate.mapon) || (gamestate.flags & GS_QUICKRUN))
		return;

	ThreeDRefresh();
	ThreeDRefresh();
	ClearMemory();
	WindowX=0; WindowY=16; WindowW=320; WindowH=168;
	CacheMessage(QUICK_INFO1_TEXT);
	VW_WaitVBL(120);
	CacheMessage(QUICK_INFO2_TEXT);
	IN_Ack();
	IN_ClearKeysDown();
	CleanDrawPlayBorder();
}
Exemplo n.º 20
0
void IN_StartAck(void)
{
    IN_ProcessEvents();
//
// get initial state of everything
//
	IN_ClearKeysDown();
	memset(btnstate, 0, sizeof(btnstate));

	int buttons = IN_JoyButtons() << 4;

	if(MousePresent)
		buttons |= IN_MouseButtons();

	for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
		if(buttons & 1)
			btnstate[i] = true;
}
Exemplo n.º 21
0
void IN_StartAck(void)
{
	unsigned	i,buttons;

//
// get initial state of everything
//
	IN_ClearKeysDown();
	memset (btnstate,0,sizeof(btnstate));

	buttons = IN_JoyButtons () << 4;
	if (MousePresent)
		buttons |= IN_MouseButtons ();

	for (i=0;i<8;i++,buttons>>=1)
		if (buttons&1)
			btnstate[i] = true;
}
Exemplo n.º 22
0
//
// END ARTICLES
//
void EndText()
{
	int artnum;
	signed char *text;

	ClearMemory();

	artnum = endextern+gamestate.episode;
	CA_CacheGrChunk(artnum);
	text = (signed char *)grsegs[artnum];

	ShowArticle(text);

	CA_UnCacheGrChunk(artnum);
	
	VW_FadeOut();
	SETFONTCOLOR(0,15);
	IN_ClearKeysDown();

	FreeMusic();
}
Exemplo n.º 23
0
void CK6_RocketCol(CK_object *a, CK_object *b)
{
  if (ck_gameState.ep.ck6.passcard == 0)
  {

      CA_CacheGrChunk(0x23);

      US_CenterWindow(26, 8);
      VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
      US_SetWindowW(US_GetWindowW() - 0x30);
      US_SetPrintY(US_GetPrintY() + 5);
      US_CPrint("The door makes a loud\n"
                "blooping noise.\n"
                "It says,\n"
                "\"Passcard required\n"
                "for entry.\"");
      VL_Present();
      SD_PlaySound(SOUND_NEEDKEYCARD);
      VL_DelayTics(30); // VW_WaitVBL(30);
      IN_ClearKeysDown();
      IN_WaitButton();
      RF_ForceRefresh();
      ck_nextX = -b->deltaPosX;
      ck_nextY = -b->deltaPosY;
      b->xDirection = b->yDirection = IN_motion_None;
      CK_PhysUpdateNormalObj(b);
  }
  else if (ck_gameState.ep.ck6.passcard == 1)
  {
    a->user1 = 0;
    a->user2 = 0x100;
    CK_SetAction2(a, CK_GetActionByName("CK6_ACT_RocketFly0"));
    b->posX = a->posX;
    b->posY = a->posY + 0x100;
    b->clipped = CLIP_not;
    CK_SetAction2(b, CK_GetActionByName("CK6_ACT_MapKeenRocketSit0"));
    SD_PlaySound(SOUND_ROCKETLAUNCH);
    SD_WaitSoundDone();
  }
}
Exemplo n.º 24
0
///////////////////////////////////////////////////////////////////////////
//
//	IN_Startup() - Starts up the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Startup(void)
{
	if (IN_Started)
		return;

    IN_ClearKeysDown();

    if(param_joystickindex >= 0 && param_joystickindex < SDL_NumJoysticks())
    {
        Joystick = SDL_JoystickOpen(param_joystickindex);
        if(Joystick)
        {
            JoyNumButtons = SDL_JoystickNumButtons(Joystick);
            if(JoyNumButtons > 32) JoyNumButtons = 32;      // only up to 32 buttons are supported
            JoyNumHats = SDL_JoystickNumHats(Joystick);
            if(param_joystickhat < -1 || param_joystickhat >= JoyNumHats)
                Quit("The joystickhat param must be between 0 and %i!", JoyNumHats - 1);
        }
    }

    SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);

    if(fullscreen || forcegrabmouse)
    {
        GrabInput = true;
        SDL_WM_GrabInput(SDL_GRAB_ON);
    }

    // I didn't find a way to ask libSDL whether a mouse is present, yet...
#if defined(GP2X)
    MousePresent = false;
#elif defined(_arch_dreamcast)
    MousePresent = DC_MousePresent();
#else
    MousePresent = true;
#endif

    IN_Started = true;
}
Exemplo n.º 25
0
void CK6_ShowGetSandwich()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 12);
	US_CPrint("This is the second\n"
		  "biggest sandwich\n"
		  "I ever saw!\n");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.sandwich = true;
}
Exemplo n.º 26
0
void CK6_ShowGetRope()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 12);
	US_CPrint("Wow! A rope and\n"
		  "grappling hook!\n"
		  "They look useful!\n");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.rope = true;
}
Exemplo n.º 27
0
void CK6_ShowGetPasscard()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 4);
	US_CPrint("What's this? Cool!\n"
		  "A passcard for\n"
		  "the Bloogstar Rocket!\n"
		  "(It can fly though\n"
		  "their force field.)");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.passcard = true;
}
Exemplo n.º 28
0
void ChangeSwapFiles(boolean display)
{
	ClearMemory();

   if (display)
   {
		WindowX=WindowY=0;
		WindowW=320;
		WindowH=200;
	   Message(Computing);
   }

	PM_Shutdown();
	PM_Startup ();

	PM_CheckMainMem();

   if (display)
   {
	   IN_UserInput(50);
		CleanDrawPlayBorder();
		IN_ClearKeysDown();
   }
}
Exemplo n.º 29
0
int
USL_HardError(word errval,int ax,int bp,int si)
{
#define IGNORE  0
#define RETRY   1
#define	ABORT   2
extern	void	ShutdownId(void);

static	char		buf[32];
static	WindowRec	wr;
		int			di;
		char		c,*s,*t;

	di = _DI;

	if (ax < 0)
		s = "DEVICE ERROR";
	else
	{
		if ((di & 0x00ff) == 0)
			s = "DRIVE ~ IS WRITE PROTECTED";
		else
			s = "ERROR ON DRIVE ~";
		for (t = buf;*s;s++,t++)	// Can't use sprintf()
			if ((*t = *s) == '~')
				*t = (ax & 0x00ff) + 'A';
		*t = '\0';
		s = buf;
	}

	c = peekb(0x40,0x49);	// Get the current screen mode
	if ((c < 4) || (c == 7))
		goto oh_kill_me;

	// DEBUG - handle screen cleanup

   fontnumber = 4;
	US_SaveWindow(&wr);
	US_CenterWindow(30,3);
	US_CPrint(s);
	US_CPrint("(R)ETRY or (A)BORT?");
	VW_UpdateScreen();
	IN_ClearKeysDown();

asm	sti	// Let the keyboard interrupts come through

	while (true)
	{
		switch (IN_WaitForASCII())
		{
		case key_Escape:
		case 'a':
		case 'A':
			goto oh_kill_me;
			break;
		case key_Return:
		case key_Space:
		case 'r':
		case 'R':
			US_ClearWindow();
			VW_UpdateScreen();
			US_RestoreWindow(&wr);
			return(RETRY);
			break;
		}
	}

oh_kill_me:
	abortprogram = s;
	ShutdownId();
	fprintf(stderr,"TERMINAL ERROR: %s\n",s);
	return(ABORT);

#undef	IGNORE
#undef	RETRY
#undef	ABORT
}
Exemplo n.º 30
0
///////////////////////////////////////////////////////////////////////////
//
//  US_LineInput() - Gets a line of user input at (x,y), the string defaults
//      to whatever is pointed at by def. Input is restricted to maxchars
//      chars or maxwidth pixels wide. If the user hits escape (and escok is
//      true), nothing is copied into buf, and false is returned. If the
//      user hits return, the current string is copied into buf, and true is
//      returned
//
///////////////////////////////////////////////////////////////////////////
boolean
US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
                int maxchars,int maxwidth)
{
   boolean     redraw,
               cursorvis,cursormoved,
               done,result, checkkey;
   ScanCode    sc;
   char        c;
   char        s[MaxString],olds[MaxString];
   int         cursor,len;
   word        i,
               w,h,
               temp;
   longword    curtime, lasttime, lastdirtime, lastbuttontime, lastdirmovetime;
   ControlInfo ci;
   Direction   lastdir = dir_None;

   if (def)
      strcpy(s,def);
   else
      *s = '\0';
   *olds = '\0';
   cursor = (int) strlen(s);
   cursormoved = redraw = true;

   cursorvis = done = false;
   lasttime = lastdirtime = lastdirmovetime = GetTimeCount();
   lastbuttontime = lasttime + TickBase / 4;   // 250 ms => first button press accepted after 500 ms
   LastASCII = key_None;
   LastScan = sc_None;

   while (!done)
   {
      ReadAnyControl(&ci);

      if (cursorvis)
         USL_XORICursor(x,y,s,cursor);

      sc = LastScan;
      LastScan = sc_None;
      c = LastASCII;
      LastASCII = key_None;

      checkkey = true;
      curtime = GetTimeCount();

      // After each direction change accept the next change after 250 ms and then everz 125 ms
      if(ci.dir != lastdir || ((curtime - lastdirtime > TickBase / 4) && (curtime - lastdirmovetime > TickBase / 8)))
      {
         if(ci.dir != lastdir)
         {
            lastdir = ci.dir;
            lastdirtime = curtime;
         }
         lastdirmovetime = curtime;

         switch(ci.dir)
         {
            case dir_West:
               if(cursor)
               {
                  // Remove trailing whitespace if cursor is at end of string
                  if(s[cursor] == ' ' && s[cursor + 1] == 0)
                     s[cursor] = 0;
                  cursor--;
               }
               cursormoved = true;
               checkkey = false;
               break;
            case dir_East:
               if(cursor >= MaxString - 1) break;

               if(!s[cursor])
               {
                  USL_MeasureString(s,&w,&h);
                  if(len >= maxchars || (maxwidth && w >= maxwidth))
                     break;

                  s[cursor] = ' ';
                  s[cursor + 1] = 0;
               }
               cursor++;
               cursormoved = true;
               checkkey = false;
               break;

            case dir_North:
               if(!s[cursor])
               {
                  USL_MeasureString(s,&w,&h);
                  if(len >= maxchars || (maxwidth && w >= maxwidth))
                     break;
                  s[cursor + 1] = 0;
               }
               s[cursor] = USL_RotateChar(s[cursor], 1);
               redraw = true;
               checkkey = false;
               break;

            case dir_South:
               if(!s[cursor])
               {
                  USL_MeasureString(s,&w,&h);
                  if(len >= maxchars || (maxwidth && w >= maxwidth))
                     break;
                  s[cursor + 1] = 0;
               }
               s[cursor] = USL_RotateChar(s[cursor], -1);
               redraw = true;
               checkkey = false;
               break;
            default:
               break;
         }
      }

      if((int)(curtime - lastbuttontime) > TickBase / 4)   // 250 ms
      {
         if(ci.button0)             // acts as return
         {
            strcpy(buf,s);
            done = true;
            result = true;
            checkkey = false;
         }
         if(ci.button1 && escok)    // acts as escape
         {
            done = true;
            result = false;
            checkkey = false;
         }
         if(ci.button2)             // acts as backspace
         {
            lastbuttontime = curtime;
            if(cursor)
            {
               strcpy(s + cursor - 1,s + cursor);
               cursor--;
               redraw = true;
            }
            cursormoved = true;
            checkkey = false;
         }
      }

      if(checkkey)
      {
         switch (sc)
         {
            case sc_LeftArrow:
               if (cursor)
                  cursor--;
               c = key_None;
               cursormoved = true;
               break;
            case sc_RightArrow:
               if (s[cursor])
                  cursor++;
               c = key_None;
               cursormoved = true;
               break;
            case sc_Home:
               cursor = 0;
               c = key_None;
               cursormoved = true;
               break;
            case sc_End:
               cursor = (int) strlen(s);
               c = key_None;
               cursormoved = true;
               break;

            case sc_Return:
               strcpy(buf,s);
               done = true;
               result = true;
               c = key_None;
               break;
            case sc_Escape:
               if (escok)
               {
                  done = true;
                  result = false;
               }
               c = key_None;
               break;

            case sc_BackSpace:
               if (cursor)
               {
                  strcpy(s + cursor - 1,s + cursor);
                  cursor--;
                  redraw = true;
               }
               c = key_None;
               cursormoved = true;
               break;
            case sc_Delete:
               if (s[cursor])
               {
                  strcpy(s + cursor,s + cursor + 1);
                  redraw = true;
               }
               c = key_None;
               cursormoved = true;
               break;

            case SDLK_KP5: //0x4c:  // Keypad 5 // TODO: hmmm...
            case sc_UpArrow:
            case sc_DownArrow:
            case sc_PgUp:
            case sc_PgDn:
            case sc_Insert:
               c = key_None;
               break;
         }

         if (c)
         {
            len = (int) strlen(s);
            USL_MeasureString(s,&w,&h);

            if(isprint(c) && (len < MaxString - 1) && ((!maxchars) || (len < maxchars))
                  && ((!maxwidth) || (w < maxwidth)))
            {
               for (i = len + 1;i > cursor;i--)
                  s[i] = s[i - 1];
               s[cursor++] = c;
               redraw = true;
            }
         }
      }

      if (redraw)
      {
         px = x;
         py = y;
         temp = fontcolor;
         fontcolor = backcolor;
         USL_DrawString(olds);
         fontcolor = (byte) temp;
         strcpy(olds,s);

         px = x;
         py = y;
         USL_DrawString(s);

         redraw = false;
      }

      if (cursormoved)
      {
         cursorvis = false;
         lasttime = curtime - TickBase;

         cursormoved = false;
      }
      if (curtime - lasttime > TickBase / 2)    // 500 ms
      {
         lasttime = curtime;

         cursorvis ^= true;
      }
      else rarch_sleep(5);
      if (cursorvis)
         USL_XORICursor(x,y,s,cursor);

      VW_UpdateScreen();
   }

   if (cursorvis)
      USL_XORICursor(x,y,s,cursor);
   if (!result)
   {
      px = x;
      py = y;
      USL_DrawString(olds);
   }
   VW_UpdateScreen();

   IN_ClearKeysDown();
   return(result);
}