Пример #1
0
BOOL CDlgHistoryLogUser::InitControl()
{
	// 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、
	DWORD dwStyle;
	dwStyle = m_ListCtrl_UserLog.GetStyle();
	dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT;
	m_ListCtrl_UserLog.SetExtendedStyle(dwStyle);

	InitControlList();

	m_strNodeName = "全部用户";

//	m_ComboType.InsertString(0, "所有类型");
	m_ComboType.InsertString(0,"管理端操作");
	m_ComboType.InsertString(1,"客户端操作");
	m_ComboType.InsertString(2,"辅助管理端操作");
	m_ComboType.SetCurSel(0);

	m_ComboSubType.InsertString(0, "所有分类型");
	m_ComboSubType.SetCurSel(0);

	CTime	nowtime	= CTime::GetCurrentTime();
	CTime	StartTime(nowtime.GetYear(), nowtime.GetMonth(),nowtime.GetDay(), 0, 0, 0);
	CTime	StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59);

	//开始时间初始化
	m_StartDay = StartTime;
	m_StartTime = StartTime;
	m_StopDay  = StopTime;
	m_StopTime  = StopTime;

	UpdateData(FALSE);

	return TRUE;
}
Пример #2
0
Файл: med.c Проект: paud/d2x-xl
int	GotoGameCommon(int mode) {
	StopTime();

//@@	init_player_stats();
//@@
//@@	gameData.multiplayer.playerInit.position.vPos = Player->position.vPos;
//@@	gameData.multiplayer.playerInit.position.mOrient = Player->position.mOrient;
//@@	gameData.multiplayer.playerInit.nSegment = Player->nSegment;

// -- must always save gamesave.sav because the restore-gameData.objs.objects code relies on it
// -- that code could be made smarter and use the original file, if appropriate.
//	if (mine_changed) 
	if (gamestate_not_restored == 0) {
		gamestate_not_restored = 1;
		SaveLevel("GAMESAVE.LVL");
		editor_status("Gamestate saved.\n");
	}

	AIResetAllPaths();

	StartTime();

	ModeFlag = mode;
	return 1;
}
Пример #3
0
void
wxGamePanel::UpdateTime()
{
    // 경기 시간 갱신
    wxString timeStr(wxT("00:00"));
    long remainTime = m_periLen - m_elapseTime.Time();
    if (remainTime > 0) {
        timeStr = wxTimeSpan::Milliseconds(remainTime).Format(wxT("%M:%S"));
    }
    else {
        StartBuzzer();
        StopTime();
    }
    m_timeCtrl->SetValue(timeStr);

    // 공격 시간 갱신
    wxString shotClockStr(wxT("00"));
    long remainShotClock = m_shotClock - m_attackTime.Time();
    if (remainShotClock > 0) {
        shotClockStr
            = wxTimeSpan::Milliseconds(remainShotClock).Format(wxT("%S"));
    }
    else {
        if (m_playing) {
            StartBuzzer();

            // 무한 재귀 호출을 막기 위해서, false를 인자로 전달한다.
            ResetShotClock(false);
        }
    }
    m_shotClockCtrl->SetValue(shotClockStr);
}
Пример #4
0
//this should be called regularly to check for redbook restart
void songs_check_redbook_repeat()
{
	static fix last_check_time;
	fix current_time;

	if (!gameStates.sound.bRedbookPlaying || gameConfig.nRedbookVolume==0) return;

	current_time = TimerGetFixedSeconds();
	if (current_time < last_check_time || (current_time - last_check_time) >= F2_0) {
		if (!RBAPeekPlayStatus()) {
			StopTime();
			// if title ends, start credit music
			// if credits music ends, restart it
			if (gameStates.sound.bRedbookPlaying == REDBOOK_TITLE_TRACK || gameStates.sound.bRedbookPlaying == REDBOOK_CREDITS_TRACK)
				play_redbook_track(REDBOOK_CREDITS_TRACK,0);
			else {
				//songs_goto_next_song();
	
				//new code plays all tracks to end of disk, so if disk has
				//stopped we must be at end.  So start again with level 1 song.
	
				PlayLevelSong(1);
			}
			StartTime();
		}
		last_check_time = current_time;
	}
}
Пример #5
0
void LoadAllTextures (void)
{
    int 	bBlackScreen;

    StopTime ();
    bBlackScreen = paletteManager.EffectDisabled ();
    if (paletteManager.EffectDisabled ()) {
        CCanvas::Current ()->Clear (BLACK_RGBA);
        paletteManager.LoadEffect ();
    }
//	messageBox.Show (TXT_LOADING);
    LoadSegmentTextures ();
    LoadWallTextures ();
    LoadPowerupTextures ();
    LoadWeaponTextures ();
    LoadPowerupTextures ();
    LoadGaugeTextures ();
    LoadVClipTextures (&gameData.eff.vClips [0][VCLIP_PLAYER_APPEARANCE], 0);
    LoadVClipTextures (&gameData.eff.vClips [0][VCLIP_POWERUP_DISAPPEARANCE], 0);
    LoadAddonTextures ();
    if (bBlackScreen) {
        paletteManager.ClearEffect ();
        CCanvas::Current ()->Clear (BLACK_RGBA);
    }
    StartTime (0);
}
Пример #6
0
void joy_delay()
{
	StopTime();
	timer_delay(.25);
	//delay(250);				// changed by allender because	1) more portable
							//								2) was totally broken on PC
	joy_flush();
	StartTime();
}
Пример #7
0
ALERROR CUniverse::InitImages (SDesignLoadCtx &Ctx, CXMLElement *pImages, CResourceDb &Resources)

//	InitImages
//
//	Loads all images

	{
	ALERROR error;

	//	Nothing to do if we don't want to load resources

	if (Ctx.bNoResources)
		return NOERROR;

	//	Figure out if we've got a special folder for the images

	CString sRoot = pImages->GetAttribute(FOLDER_ATTRIB);
	Ctx.sFolder = sRoot;

#ifdef DEBUG_TIME_IMAGE_LOAD
	CTimeDate StartTime(CTimeDate::Now);
#endif

	//	Load all images

	for (int i = 0; i < pImages->GetContentElementCount(); i++)
		{
		CXMLElement *pItem = pImages->GetContentElement(i);

		if (error = LoadImage(Ctx, pItem))
			return error;
		}

	//	Restore folder

	Ctx.sFolder = NULL_STR;

#ifdef DEBUG_TIME_IMAGE_LOAD
	{
	CTimeDate StopTime(CTimeDate::Now);
	CTimeSpan Timing = timeSpan(StartTime, StopTime);
	CString sTime = Timing.Format(CString());
	kernelSetDebugLog("Time to load images: ");
	kernelSetDebugLog(sTime.GetASCIIZPointer());
	kernelSetDebugLog("\n");
	}
#endif

	return NOERROR;
	}
Пример #8
0
Файл: med.c Проект: paud/d2x-xl
// Returns 1 if OK to trash current mine.
int SafetyCheck()
{
	int x;
		
	if (mine_changed) {
		StopTime();			
		x = ExecMessageBox( "Warning!", 2, "Cancel", "OK", "You are about to lose work." );
		if (x<1) {
			StartTime();
			return 0;
		}
		StartTime();
	}
	return 1;
}
Пример #9
0
void PauseGame (void)
{
if (!gameData.app.bGamePaused) {
	gameData.app.bGamePaused = 1;
	audio.PauseAll ();
	RBAPause ();
	StopTime ();
	paletteManager.SaveEffect ();
	paletteManager.ResetEffect ();
	GameFlushInputs ();
#if defined (TACTILE)
	if (TactileStick)
		DisableForces();
#endif
	}
}
BOOL CDlgHistoryLogSystem::InitControl()
{
	// 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、
	DWORD dwStyle;
	dwStyle = m_ListCtrl_SystemLog.GetStyle();
	dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT;
	m_ListCtrl_SystemLog.SetExtendedStyle(dwStyle);

	m_ListCtrl_SystemLog.InsertColumn(0,"服务器名称");
	m_ListCtrl_SystemLog.SetColumnWidth(0,120);
	m_ListCtrl_SystemLog.InsertColumn(1,"服务器类型");
	m_ListCtrl_SystemLog.SetColumnWidth(1,120);
	m_ListCtrl_SystemLog.InsertColumn(2,"服务器状态");
	m_ListCtrl_SystemLog.SetColumnWidth(2,120);
	m_ListCtrl_SystemLog.InsertColumn(3,"CPU使用率");
	m_ListCtrl_SystemLog.SetColumnWidth(3,120);
	m_ListCtrl_SystemLog.InsertColumn(4,"内存使用率");
	m_ListCtrl_SystemLog.SetColumnWidth(4,120);
	m_ListCtrl_SystemLog.InsertColumn(5,"内存使用量");
	m_ListCtrl_SystemLog.SetColumnWidth(5,120);
	m_ListCtrl_SystemLog.InsertColumn(6,"磁盘使用量");
	m_ListCtrl_SystemLog.SetColumnWidth(6,120);
	m_ListCtrl_SystemLog.InsertColumn(7,"更新时间");
	m_ListCtrl_SystemLog.SetColumnWidth(7,120);

	m_ComboType.InsertString(0, "所有类型");
	m_ComboType.SetCurSel(0);

	m_ComboSubType.InsertString(0, "所有分类型");
	m_ComboSubType.SetCurSel(0);

	CTime	nowtime	= CTime::GetCurrentTime();
	CTime	StartTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 0, 0, 0);
	CTime	StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59);

	//开始时间初始化
	m_StartDay = StartTime;
	m_StartTime = StartTime;
	m_StopDay  = StopTime;
	m_StopTime  = StopTime;

	UpdateData(FALSE);

	return TRUE;
}
Пример #11
0
void CDlgHistoryLogUser::OnDtnDatetimechangeDatetimepickerHlStopday(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMDATETIMECHANGE pDTChange = reinterpret_cast<LPNMDATETIMECHANGE>(pNMHDR);

	char str[64];
	CTime	nowtime;
	GetDlgItemText(IDC_DATETIMEPICKER_HL_STOPDAY,str,64);
	if ((memcmp(str,"1971-",5) < 0)||(memcmp(str,"2037-",5) > 0))
	{	
		nowtime	= CTime::GetCurrentTime();
		CTime	StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59);
		m_StopDay  = StopTime;
		m_StopTime  = StopTime;
		UpdateData(false);
	}


	*pResult = 0;
}
Пример #12
0
void CheckInfortuni(player_t *g)
{
    if( (injuries&&GetTable()>3) || killer)
    {
        char t;

        if(!g)
            return;

        g->stamina--;

        if(GetTable()>g->stamina || killer)
        {
            g->stamina=0;

            TogliPalla();

            g->speed=2;
            t=GetTable()-2;
            g->tackle=max(1,t);
            g->Tiro=max(1,t);
            g->creativity=max(1,t);

            g->ActualSpeed=0;

            DoSpecialAnim(g,GIOCATORE_INFORTUNIO);

            if(injuries)
            {
                StopTime();

                p->player_injuried=g;

                if(g->team->Joystick>=0)
                    p->show_panel=PANEL_INJURIED;

                p->show_time=200;
            }
        }
    }
}
Пример #13
0
void PagingTouchAllSub ()
{
    int 			bBlackScreen;

    StopTime ();
    bBlackScreen = gameStates.render.bPaletteFadedOut;
    if (gameStates.render.bPaletteFadedOut)	{
        GrClearCanvas (BLACK_RGBA);
        GrPaletteStepLoad (NULL);
    }
//	ShowBoxedMessage (TXT_LOADING);
#if TRACE
    con_printf (CON_VERBOSE, "Loading all textures in mine...");
#endif
    PagingTouchSegments ();
    PagingTouchWalls ();
    PagingTouchPowerups ();
    PagingTouchWeapons ();
    PagingTouchPowerups ();
    PagingTouchGauges ();
    PagingTouchVClip (&gameData.eff.vClips [0][VCLIP_PLAYER_APPEARANCE], 0);
    PagingTouchVClip (&gameData.eff.vClips [0][VCLIP_POWERUP_DISAPPEARANCE], 0);
    PagingTouchAddonTextures ();

#if TRACE
    con_printf (CON_VERBOSE, "... loading all textures in mine done\n");
#endif
//@@	ClearBoxedMessage ();

    if (bBlackScreen)	{
        GrPaletteStepClear ();
        GrClearCanvas (BLACK_RGBA);
    }
    StartTime (0);
    ResetCockpit ();		//force cockpit redraw next time

}
Пример #14
0
void MoveNonControlled(void)
{
    register int i;
    register WORD xg,yg;
    register player_t *g;
    register team_t *s;
    WORD xlimit_e,ylimit_s,xlimit_o,ylimit_n,j;

    // Cacho un paio di cose :)

    xlimit_e=field_x+WINDOW_WIDTH;
    ylimit_s=field_y+WINDOW_HEIGHT;
    xlimit_o=field_x-16;
    ylimit_n=field_y-20;

    for(j=0;j<2;j++)
    {
        s= p->team[j];

        if(s->ArcadeEffect)
        {
            s->ArcadeCounter--;

            if(s->ArcadeCounter==0)
                RemoveArcadeEffect(&s->players[0],s->ArcadeEffect);
        }

        for(i=0;i<10;i++)
        {
            g = &(s->players[i]);

            xg=g->world_x>>3;
            yg=g->world_y>>3;

            if(     xg>xlimit_o &&
                    xg<xlimit_e &&
                    yg>ylimit_n &&
                    yg<ylimit_s   )
            {
                if(!g->OnScreen)
                {

#if 0
                    /* this is to debug replay code, cause a segfault */
                    if(arcade && j==1 && i==4)
                    {
                        char *a=NULL;
                        *a=0;
                    }
#endif
                    AddAnimObj(g->anim,xg-field_x,yg-field_y,Animation[g->AnimType].Frame[0]+g->dir);

                    g->OnScreen=TRUE;
                }
                else
                {
                    MoveAnimObj(g->anim,xg-field_x,yg-field_y);
                }

                /* aggiungere qui il check sulle collisioni, le controllo solo se onscreen */

                /* Check collisions with the ball */

            }
            else if(g->OnScreen)
            {
                if(g->Controlled&&s->MarkerOnScreen)
                {
                    RemAnimObj(s->Marker);
                    s->MarkerOnScreen=FALSE;
                }

                RemAnimObj(g->anim);
                g->OnScreen=FALSE;
            }

            if(
                    s!=pl->sq_palla        &&
                    pl->quota<8     &&
                    pl->world_x>(g->world_x-64)     &&
                    pl->world_x<(g->world_x+160)    &&
                    pl->world_y>(g->world_y+96)     &&
                    pl->world_y<(g->world_y+190)    &&
                    pl->InGioco     &&
                    !pl->Hide    &&
                    (!g->Special || g->AnimType==GIOCATORE_SCIVOLATA)
              )
            {

                if (pl->gioc_palla) {
                    if (pl->gioc_palla->ArcadeEffect == ARCADE_GLUE)
                        goto skipchange;

                    if (g->AnimType != GIOCATORE_SCIVOLATA) {
                        if (pl->gioc_palla->technique > (g->tackle+2+GetTable())) {
                            g->ActualSpeed=0;
                            DoSpecialAnim(g,GIOCATORE_CONTRASTO);
                            goto skipchange;
                        }

                        if (GetTable()>2) {
                            DoSpecialAnim(pl->gioc_palla,GIOCATORE_CONTRASTO);
                        }
                        else {
                            DoSpecialAnim(pl->gioc_palla,GIOCATORE_CADUTA);
                        }

                        pl->gioc_palla->ActualSpeed=0;
                    }
                    else {
                        if (GetTable() > 1) {

                            switch (GetTable()) {
                                case 4:
                                case 5:
                                    //                                PlayIfNotPlaying(BOOU);
                                    SetCrowd(BOOU);
                                    break;
                                case 1:
                                    PlayBackSound(sound[OUCH2]);
                                    break;
                                case 2:
                                    PlayBackSound(sound[OUCH]);
                                    break;
                            }

                            if (pl->gioc_palla->ActualSpeed > 0) {
                                DoSpecialAnim(pl->gioc_palla,GIOCATORE_CADUTA);
                                pl->gioc_palla->ActualSpeed=1;
                                CheckInfortuni(pl->gioc_palla);
                            }
                            else {
                                if(GetTable() > 2) {
                                    DoSpecialAnim(pl->gioc_palla,GIOCATORE_CADUTA_FERMO);
                                    CheckInfortuni(pl->gioc_palla);
                                }
                                else {
                                    DoSpecialAnim(pl->gioc_palla,GIOCATORE_CADUTA_CARPONI);
                                }
                            }


                            if(!arcade && GetTable()>2) // arbitro abilita' (da aggiungere)
                            {
                                p->referee.Comando=FISCHIA_FALLO;

                                StopTime();

                                if(!replay_mode)
                                    UrgentSpeaker(S_CALCIO_DI_PUNIZIONE);


                                FermaPalla();
                                TogliPalla();

                                pl->InGioco=FALSE;

                                if(p->team[0]->Possesso)
                                {
                                    pl->sq_palla=p->team[0];
                                }
                                else
                                {
                                    pl->sq_palla=p->team[1];
                                }

                                if(bookings)
                                {
                                    if(GetTable()<4)
                                    {
                                        if(GetTable()>((11-p->referee.cattiveria)>>1))
                                        {
                                            if(!g->Ammonito)
                                            {
                                                p->team[g->SNum]->Ammonizioni++;
                                                p->referee.Comando=AMMONIZIONE;
                                            }
                                            else
                                            {
                                                p->team[g->SNum]->Espulsioni++;
                                                p->referee.Comando=ESPULSIONE;
                                            }

                                            p->referee.Tick=-50;
                                            p->show_panel|=PANEL_TIME|PANEL_CARD;
                                            p->referee.Argomento=g->GNum+g->SNum*10;
                                        }
                                    }
                                    else if(GetTable()>((12-p->referee.cattiveria)>>1))
                                    {
                                        p->team[g->SNum]->Espulsioni++;
                                        p->referee.Comando=ESPULSIONE;
                                        p->referee.Argomento=g->GNum+g->SNum*10;
                                        p->referee.Tick=-50;
                                        p->show_panel|=PANEL_TIME|PANEL_CARD;
                                    }
                                }

                                goto skipchange;
                            }
                            else if(injuries && p->player_injuried)
                            {
                                RestartTime();
                                p->show_panel=PANEL_PLAY_INJURIED;
                                p->show_time=150;
                            }
                        }
                        else
                        {
                            if(GetTable()>2)
                                if(!replay_mode)
                                    UrgentSpeaker(S_PALLA_PERSA);

                            if(GetTable()>2)
                            {
                                DoSpecialAnim(pl->gioc_palla,GIOCATORE_CONTRASTO);
                            }
                            else
                            {
                                DoSpecialAnim(pl->gioc_palla,GIOCATORE_CADUTA);
                            }

                            pl->gioc_palla->ActualSpeed=0;
                        }
                    }

                    TogliPalla();

                    DaiPalla(g);
                    g->WaitForControl=0;

                    if(s->Joystick<0)
                        while((s->Schema=GetTable())>3);

                    ChangeControlled(s, i);

                    pl->world_x = avanzamento_x[g->dir]+g->world_x;
                    pl->world_y = avanzamento_y[g->dir]+g->world_y;

skipchange:
                    PlayIfNotPlaying(CONTRASTO);
                }
Пример #15
0
int PageInBitmap (CBitmap *bmP, const char *bmName, int nIndex, int bD1, bool bHires)
{
	CBitmap			*altBmP = NULL;
	int				nFile, nSize, nOffset, nFrames, nShrinkFactor, nBestShrinkFactor,
						bRedone = 0, bTGA;
	sbyte				nFlags;
	bool				bDefault = false;
	CFile				cf, *cfP = &cf;
	char				fn [6][FILENAME_LEN];

#if DBG
if (!bmName)
	return 0;
if ((nDbgTexture > 0) && (nIndex == nDbgTexture))
	nDbgTexture = nDbgTexture;
#endif
if (bmP->Buffer ())
	return 1;

StopTime ();
nShrinkFactor = 8 >> min (gameOpts->render.textures.nQuality, gameStates.render.nMaxTextureQuality);
if (nShrinkFactor < 4) {
	if (nShrinkFactor == 1)
		nShrinkFactor = 2;	// cap texture quality at 256x256 (x frame#)
	else if (IsPowerup (bmName) || IsWeapon (bmName))	// force downscaling of powerup hires textures
		nShrinkFactor <<= 1;
	}
nSize = (int) bmP->FrameSize ();
if (nIndex >= 0)
	GetFlagData (bmName, nIndex);
#if DBG
if (strstr (bmName, "metl139"))
	bmName = bmName;
#endif
if (gameStates.app.bNostalgia)
	gameOpts->render.textures.bUseHires [0] = 0;

bTGA = 0;
nFlags = (nIndex < 0) ? 0 : gameData.pig.tex.bitmapFlags [bD1][nIndex];
if (bmP->Texture ())
	bmP->Texture ()->Release ();
bmP->SetBPP (1);

if ((*bmName && /*!gameStates.app.bDemoData &&*/ ((nIndex < 0) || IsCockpit (bmName) || bHires || gameOpts->render.textures.bUseHires [0])) &&
	 !(gameOpts->render.powerups.b3D && IsWeapon (bmName) && !gameStates.app.bHaveMod)) {
#if 0
	if ((nIndex >= 0) && ReadS3TC (gameData.pig.tex.altBitmaps [bD1] + nIndex, gameFolders.szTextureCacheDir [bD1], bmName)) {
		altBmP = gameData.pig.tex.altBitmaps [bD1] + nIndex;
		altBmP->nType = BM_TYPE_ALT;
		bmP->SetOverride (altBmP);
		BM_FRAMECOUNT (altBmP) = 1;
		nFlags &= ~BM_FLAG_RLE;
		nFlags |= BM_FLAG_TGA;
		bmP = altBmP;
		altBmP = NULL;
		}
	else
#endif
	if (*gameFolders.szTextureDir [2]) {
		char szLevelFolder [FILENAME_LEN];
		if (gameData.missions.nCurrentLevel < 0)
			sprintf (szLevelFolder, "slevel%02d", -gameData.missions.nCurrentLevel);
		else
			sprintf (szLevelFolder, "level%02d", gameData.missions.nCurrentLevel);
		sprintf (gameFolders.szTextureDir [3], "%s/%s", gameFolders.szTextureDir [2], szLevelFolder);
		sprintf (gameFolders.szTextureCacheDir [3], "%s/%s", gameFolders.szTextureCacheDir [2], szLevelFolder);
		}
	else
		*gameFolders.szTextureDir [3] =
		*gameFolders.szTextureCacheDir [3] = '\0';
	MakeBitmapFilenames (bmName, gameFolders.szTextureDir [3], gameFolders.szTextureCacheDir [3], fn [1], fn [0], nShrinkFactor);
	MakeBitmapFilenames (bmName, gameFolders.szTextureDir [2], gameFolders.szTextureCacheDir [2], fn [3], fn [2], nShrinkFactor);
	MakeBitmapFilenames (bmName, gameFolders.szTextureDir [bD1], gameFolders.szTextureCacheDir [bD1], fn [5], fn [4], nShrinkFactor);

	if (0 <= (nFile = OpenBitmapFile (fn, cfP))) {
		cfP->Close ();
		PrintLog ("loading hires texture '%s' (quality: %d)\n", fn [nFile], min (gameOpts->render.textures.nQuality, gameStates.render.nMaxTextureQuality));
		if (nFile < 2)	//was level specific mod folder
			MakeTexSubFolders (gameFolders.szTextureCacheDir [3]);
		if (nIndex < 0)
			altBmP = &gameData.pig.tex.addonBitmaps [-nIndex - 1];
		else
			altBmP = &gameData.pig.tex.altBitmaps [bD1][nIndex];
		if (!ReadTGA (fn [nFile], "", altBmP)) {
			altBmP = NULL;
			if (!bDefault)
				cfP->Close ();
			throw (EX_OUT_OF_MEMORY);
			}
		else {
			bTGA = 1;
			if (strstr (fn [nFile], "omegblob#") && strstr (fn [nFile], "/mods/"))
				gameStates.render.bOmegaModded = 1;
			altBmP->SetType (BM_TYPE_ALT);
			bmP->SetOverride (altBmP);
			bmP = altBmP;
			bmP->DelFlags (BM_FLAG_RLE);
			nSize = bmP->Size ();
			nFrames = (bmP->Height () % bmP->Width ()) ? 1 : bmP->Height () / bmP->Width ();
			bmP->SetFrameCount (ubyte (nFrames));
			nOffset = -1;
			if (nIndex >= 0) {
				nFlags = bmP->Flags ();
				if (bmP->Height () > bmP->Width ()) {
					tEffectClip	*ecP = NULL;
					tWallClip *wcP;
					tVideoClip *vcP;
					while ((ecP = FindEffect (ecP, nIndex))) {
						//e->vc.nFrameCount = nFrames;
						ecP->flags |= EF_ALTFMT;
						//ecP->vClipInfo.flags |= WCF_ALTFMT;
						}
					if (!ecP) {
						if ((wcP = FindWallAnim (nIndex))) {
						//w->nFrameCount = nFrames;
							wcP->flags |= WCF_ALTFMT;
							}
						else if ((vcP = FindVClip (nIndex))) {
							//v->nFrameCount = nFrames;
							vcP->flags |= WCF_ALTFMT;
							}
						else {
							PrintLog ("   couldn't find animation for '%s'\n", bmName);
							}
						}
					}
				}
			}
		}
	}

if (!altBmP) {
	if (nIndex < 0) {
		StartTime (0);
		return 0;
		}
	cfP = cfPiggy + bD1;
	if (!cfP->File ())
		PiggyInitPigFile (NULL);
	nOffset = bitmapOffsets [bD1][nIndex];
	bDefault = true;
	}

bRedone = 1;
if ((nOffset >= 0) && cfP->Seek (nOffset, SEEK_SET)) {
	if (!bDefault)
		cfP->Close ();
	throw (EX_IO_ERROR);
	}
#if 1//DBG
bmP->SetName (bmName);
#endif
#if TEXTURE_COMPRESSION
if (bmP->Compressed ())
	UseBitmapCache (bmP, bmP->CompressedSize ());
else
#endif
	{
	if (bTGA || bmP->CreateBuffer ())
		UseBitmapCache (bmP, nSize);
	}
if (!bmP->Buffer () || (bitmapCacheUsed > bitmapCacheSize)) {
	if (!bDefault)
		cfP->Close ();
	throw (EX_OUT_OF_MEMORY);
	}
if (!bTGA && (nIndex >= 0))
	bmP->SetFlags (nFlags);
bmP->SetId (nIndex);
#if DBG
if (nIndex == nDbgTexture)
	nDbgTexture = nDbgTexture;
#endif
int i = ReadBitmap (bmP, nSize, cfP, bDefault, bD1 != 0, bHires);
if (i) {
	if (i < 0) {
		if (!bDefault)
			cfP->Close ();
		throw (EX_IO_ERROR);
		}
	}
else
#if TEXTURE_COMPRESSION
if (!bmP->Compressed ())
#endif
	{
	bmP->SetType (BM_TYPE_ALT);
	bmP->SetTranspType (-1);
	if (IsOpaqueDoor (nIndex)) {
		bmP->DelFlags (BM_FLAG_TRANSPARENT);
		bmP->TransparentFrames () [0] &= ~1;
		}
#if TEXTURE_COMPRESSION
	if (CompressTGA (bmP))
		bmP->SaveS3TC (gameFolders.szTextureCacheDir [(nFile < 2) ? 3 : (nFile < 4) ? 2 : bD1], bmName);
	else {
#endif
		nBestShrinkFactor = BestShrinkFactor (bmP, nShrinkFactor);
		if ((nBestShrinkFactor > 1) && ShrinkTGA (bmP, nBestShrinkFactor, nBestShrinkFactor, 1)) {
			nSize /= (nBestShrinkFactor * nBestShrinkFactor);
			if (gameStates.app.bCacheTextures) {
				tTgaHeader	h;

				memset (&h, 0, sizeof (h));
				h.bits = bmP->BPP () * 8;
				h.width = bmP->Width ();
				h.height = bmP->Height ();
				h.imageType = 2;
				// nFile < 2: mod level texture folder
				// nFile < 4: mod texture folder
				// otherwise standard D1 or D2 texture folder
				SaveTGA (bmName, gameFolders.szTextureCacheDir [(nFile < 2) ? 3 : (nFile < 4) ? 2 : bD1], &h, bmP);
				}
			}
		}
#if TEXTURE_COMPRESSION
	}
#endif

#if DBG
nPrevIndex = nIndex;
strcpy (szPrevBm, bmName);
#endif
tRgbColorf color;
if (0 <= (bmP->AvgColor (&color)))
	bmP->SetAvgColorIndex (ubyte (bmP->Palette ()->ClosestColor (&color)));
StartTime (0);
if (!bDefault)
	cfP->Close ();
return 1;
}
Пример #16
0
int DebugKeys (void)
{
	boolean esc;
	int level,i;

#if DEBUG_KEYS_AVAILABLE
	if (Keyboard[sc_R])
	{
		CenterWindow (12,2);
		if (autofire)
		  US_PrintCentered ("Rapid-Fire OFF");
		else
		  US_PrintCentered ("Rapid-Fire ON");
		VW_UpdateScreen();
		IN_Ack();
		autofire ^= 1;
		return 1;
	}
#endif

#if DEBUG_KEYS_AVAILABLE
	if (Keyboard[sc_A])
	{
		char levelstr[50];
		unsigned org_tile,org_mapon,msgnum;
		boolean newmsg=true,newlevel=false;

		VW_FixRefreshBuffer ();
		CenterWindow (16,3);
		US_Print("\n");
		US_CPrint("Message Test");
		VW_UpdateScreen();

		org_mapon = mapon;
		msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART;
		while (1)
		{
	// Get outta' here
	//
			if (Keyboard[sc_Escape])
			{
				while (Keyboard[sc_Escape]);
				break;
			}

	// Move to previous message
	//
			if (Keyboard[sc_UpArrow])
			{
				if (msgnum)
				{
					msgnum--;
					newmsg = true;
				}
			}

	// Move to next message
	//
			if (Keyboard[sc_DownArrow])
			{
				if (msgnum < 24)
				{
					msgnum++;
					newmsg = true;
				}
			}

	// Move to previous level
	//
			if (Keyboard[sc_LeftArrow])
			{
				if (mapon)
				{
					MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
					mapon--;
					newlevel = true;
				}
			}

	// Move to next level
	//
			if (Keyboard[sc_RightArrow])
			{
				if (mapon < LASTMAP-1)
				{
					MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
					mapon++;
					newlevel = true;
				}
			}

	// Load new level text
	//
			if (newlevel)
			{
				CA_CacheGrChunk(LEVEL1TEXT+mapon);
				ScanText();
				newmsg = true;
				newlevel=false;
			}

	// Display new message text
	//
			if (newmsg)
			{
				*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART;
				DrawText(true);
				strcpy(levelstr,"Level: ");
				itoa(mapon,levelstr+strlen(levelstr),10);
				strcat(levelstr,"  Msg: ");
				itoa(msgnum,levelstr+strlen(levelstr),10);
				DisplaySMsg(levelstr,NULL);
				newmsg = false;

				if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow])
					VW_WaitVBL(6);
			}

		}
// Restore game
//
		MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
		mapon = org_mapon;
		CA_CacheGrChunk(LEVEL1TEXT+mapon);
		ScanText();
		*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile;
		DrawText(true);
		status_flag = 0;
	}


	if (Keyboard[sc_V])
	{
		displayofs = bufferofs = screenloc[screenpage];
		CenterWindow (16,4);
		US_CPrint("\n"GAMENAME);
		US_CPrint(VERSION);
		US_CPrint(REVISION);
		VW_UpdateScreen();
		IN_Ack ();
	}

#endif
	if (Keyboard[sc_Q])			// Q = Insta-Quit!
		Quit("Insta-Quit!");
#if 0
	if (Keyboard[sc_Z])		// Z = freeze Time
	{
		if (FreezeTime)
		  FreezeTime = 1;		// Allow refresh to dec to zero..
		else
			StopTime();

		IN_Ack();
		return 1;
	}
#endif


//	if (Keyboard[sc_E])
//		FaceDoor((player->x>>16l)+1,(player->y>>16l));
//		FaceAngle(90);

#if 0
	if (Keyboard[sc_B])		// B = border color
	{
		CenterWindow(24,3);
		PrintY+=6;
		US_Print(" Border color (0-15):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=15)
				VW_ColorBorder (level);
		}
		return 1;
	}
#endif


#if 1//DEBUG_KEYS_AVAILABLE
	if (Keyboard[sc_O])
	{
		extern unsigned objectcount,latchmemavail;
		unsigned unused,total;

		CenterWindow (30,13);
		US_Print ("Objects: ");
		US_PrintUnsigned (objectcount);

		US_Print("\n\nTics: ");
		US_PrintUnsigned (tics);
		US_Print("      Real Tics: ");
		US_PrintUnsigned(realtics);

		US_Print ("\n\n    Total Available: ");
		US_PrintUnsigned (mminfo.mainmem/1024);
		US_Print ("k\n        Mem In Use: ");
		unused=MM_UnusedMemory()/1024;
		US_PrintUnsigned (unused);
		US_Print ("k\n Mem After Purge: ");
		total=MM_TotalFree()/1024;
		US_PrintUnsigned (total);
		US_Print ("k (");
		US_PrintUnsigned (total-unused);

		US_Print (")\n\nLatch Mem Free: ");
		US_PrintUnsigned (latchmemavail);
		US_Print ("\n");
		VW_UpdateScreen();
		IN_Ack();
	}

	if (colordelay<1)
	{
		if (Keyboard[26])
		{
			extern unsigned *groundcolor,debug_gnd;

			groundcolor = &debug_gnd;
			debug_gnd += 0x0101;
			if (debug_gnd == 0x1010)
				debug_gnd = 0;
			colordelay = 10;
		}

		if (Keyboard[27])
		{
			extern unsigned *skycolor,debug_sky;

			skycolor = &debug_sky;
			debug_sky += 0x0101;
			if (debug_sky == 0x1010)
				debug_sky = 0;
			colordelay = 10;
		}
	}
	else
		colordelay -= realtics;
#endif


#if 0
	if (Keyboard[sc_C])		// C = count objects
	{
		CountObjects();
		return 1;
	}


	if (Keyboard[sc_D])		// D = start / end demo record
	{
		if (DemoMode == demo_Off)
			StartDemoRecord ();
		else if (DemoMode == demo_Record)
		{
			EndDemoRecord ();
			playstate = ex_completed;
		}
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_E])		// E = quit level
	{
		if (tedlevel)
			TEDDeath();
		playstate = ex_warped;
		gamestate.mapon++;
	}
#endif

#if 0
	if (Keyboard[sc_F])		// F = facing spot
	{
		CenterWindow (12,4);
		US_Print ("X:");
		US_PrintUnsigned (player->x);
		US_Print ("Y:");
		US_PrintUnsigned (player->y);
		US_Print ("A:");
		US_PrintUnsigned (player->angle);
		VW_UpdateScreen();
		IN_Ack();
		return 1;
	}
#endif

	if (Keyboard[sc_G])		// G = god mode
	{
		CenterWindow (12,2);
		if (godmode)
		  US_PrintCentered ("God mode OFF");
		else
		  US_PrintCentered ("God mode ON");
		VW_UpdateScreen();
		IN_Ack();
		godmode ^= 1;
		return 1;
	}

#if 0
	if (Keyboard[sc_H])		// H = hurt self
	{
		TakeDamage (5);
	}
#endif

	if (Keyboard[sc_I])			// I = item cheat
	{
		extern boolean redraw_gems;

		CenterWindow (12,3);
		US_PrintCentered ("Free items!");
		VW_UpdateScreen();
		for (i=0;i<4;i++)
		{
			GiveBolt ();
			GiveNuke ();
			GivePotion ();
//			if (!gamestate.keys[i])
				GiveKey (i);
			gamestate.gems[i] = GEM_DELAY_TIME;
		}
		gamestate.gems[4] = GEM_DELAY_TIME;
		redraw_gems = true;
/////////		for (i=0;i<8;i++)
/////////			GiveScroll (i,false);

		IN_Ack ();
		return 1;
	}

#if DEBUG_OVERHEAD
	if (Keyboard[sc_Z])			// O is used elsewhere...
	{
		ViewMap();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_P])			// P = pause with no screen disruptioon
	{
		PicturePause ();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_S])	// S = slow motion
	{
		singlestep^=1;
		CenterWindow (18,3);
		if (singlestep)
			US_PrintCentered ("Slow motion ON");
		else
			US_PrintCentered ("Slow motion OFF");
		VW_UpdateScreen();
		IN_Ack ();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_V])			// V = extra VBLs
	{
		CenterWindow(30,3);
		PrintY+=6;
		US_Print("  Add how many extra VBLs(0-8):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=8)
				extravbls = level;
		}
		return 1;
	}
#endif

	if (Keyboard[sc_W])	// W = warp to level
	{
		CenterWindow(26,3);
		PrintY+=6;
		US_Print("  Warp to which level(0-17):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=LASTMAP-1)
			{
				gamestate.mapon = level;
				playstate = ex_warped;
				lasttext = -1;
			}
		}
		return 1;
	}

#if 0
	if (Keyboard[sc_X])			// X = item cheat
	{
		CenterWindow (12,3);
		US_PrintCentered ("Extra stuff!");
		VW_UpdateScreen();
		for (i=0;i<4;i++)
		{
			GiveBolt ();
			GiveNuke ();
			GivePotion ();
		}
		IN_Ack ();
		return 1;
	}
#endif

////////	if (LastScan >= sc_1 && LastScan <= sc_8)	// free scrolls
////////	{
////////		GiveScroll (LastScan-sc_1,false);
////////		IN_ClearKeysDown ();
////////	}

	return 0;
}
Пример #17
0
id0_int_t DebugKeys (void)
{
	id0_boolean_t esc;
	id0_int_t level,i;

#if 0
	if (Keyboard[sc_A])
	{
		id0_char_t levelstr[50];
		id0_unsigned_t org_tile,org_mapon,msgnum;
		id0_boolean_t newmsg=true,newlevel=false;

		VW_FixRefreshBuffer ();
		CenterWindow (16,3);
		US_Print("\n");
		US_CPrint("Message Test");
		VW_UpdateScreen();

		org_mapon = mapon;
		msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART;
		while (1)
		{
	// Get outta' here
	//
			if (Keyboard[sc_Escape])
			{
				while (Keyboard[sc_Escape])
				{
					BE_ST_ShortSleep();
				}
				break;
			}

	// Move to previous message
	//
			if (Keyboard[sc_UpArrow])
			{
				if (msgnum)
				{
					msgnum--;
					newmsg = true;
				}
			}

	// Move to next message
	//
			if (Keyboard[sc_DownArrow])
			{
				if (msgnum < 24)
				{
					msgnum++;
					newmsg = true;
				}
			}

	// Move to previous level
	//
			if (Keyboard[sc_LeftArrow])
			{
				if (mapon)
				{
					MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
					mapon--;
					newlevel = true;
				}
			}

	// Move to next level
	//
			if (Keyboard[sc_RightArrow])
			{
				if (mapon < LASTMAP-2)
				{
					MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
					mapon++;
					newlevel = true;
				}
			}

	// Load new level text
	//
			if (newlevel)
			{
				CA_CacheGrChunk(LEVEL1TEXT+mapon);
				ScanText();
				newmsg = true;
				newlevel=false;
			}

	// Display new message text
	//
			if (newmsg)
			{
				*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART;
				DrawText(true);
				strcpy(levelstr,"Level: ");
				itoa(mapon,levelstr+strlen(levelstr),10);
				strcat(levelstr,"  Msg: ");
				itoa(msgnum,levelstr+strlen(levelstr),10);
				DisplaySMsg(levelstr,NULL);
				newmsg = false;

				if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow])
					VW_WaitVBL(6);
			}

			BE_ST_ShortSleep();
		}
// Restore game
//
		MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);
		mapon = org_mapon;
		CA_CacheGrChunk(LEVEL1TEXT+mapon);
		ScanText();
		*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile;
		DrawText(true);
		status_flag = 0;
	}
#endif

	if (Keyboard[sc_T])
	{
		VW_FixRefreshBuffer ();
		CenterWindow (16,4);

		US_Print("Tics      :");
		US_PrintUnsigned (tics);
		US_Print("\nReal Tics :");
		US_PrintUnsigned(realtics);
		VW_UpdateScreen();
		IN_Ack ();
	}

	if (Keyboard[sc_V])
	{
		displayofs = bufferofs = screenloc[screenpage];
		CenterWindow (20,5);
		US_CPrint(refkeen_compat_gelib_c4_debug_str_with_gamename);
		//US_CPrint("\n"GAMENAME);
		US_CPrint(VERSION);
		US_CPrint(REVISION);
		VW_UpdateScreen();
		IN_Ack ();
	}

	if (Keyboard[sc_Q])			// Q = Insta-Quit!
		Quit("Insta-Quit!");

	if (Keyboard[sc_Z])		// Z = freeze Time
	{
		if (FreezeTime)
		  FreezeTime = 1;		// Allow refresh to dec to zero..
		else
			StopTime();

		IN_Ack();
		return 1;
	}

//	if (Keyboard[sc_E])
//		FaceDoor((player->x>>16l)+1,(player->y>>16l));
//		FaceAngle(90);

#if 0
	if (Keyboard[sc_B])		// B = border color
	{
		CenterWindow(24,3);
		PrintY+=6;
		US_Print(" Border color (0-15):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=15)
				VW_ColorBorder (level);
		}
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_C])		// C = count objects
	{
		CountObjects();
		return 1;
	}


	if (Keyboard[sc_D])		// D = start / end demo record
	{
		if (DemoMode == demo_Off)
			StartDemoRecord ();
		else if (DemoMode == demo_Record)
		{
			EndDemoRecord ();
			playstate = ex_completed;
		}
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_E])		// E = quit level
	{
		if (tedlevel)
			TEDDeath();
		playstate = ex_warped;
		gamestate.mapon++;
	}
#endif

#if 0
	if (Keyboard[sc_F])		// F = facing spot
	{
		CenterWindow (12,4);
		US_Print ("X:");
		US_PrintUnsigned (player->x);
		US_Print ("Y:");
		US_PrintUnsigned (player->y);
		US_Print ("A:");
		US_PrintUnsigned (player->angle);
		VW_UpdateScreen();
		IN_Ack();
		return 1;
	}
#endif

	if (Keyboard[sc_G])		// G = god mode
	{
		CenterWindow (12,2);
		if (godmode)
		  US_PrintCentered ("God mode OFF");
		else
		  US_PrintCentered ("God mode ON");
		VW_UpdateScreen();
		IN_Ack();
		godmode ^= 1;
		return 1;
	}

#if 0
	if (Keyboard[sc_H])		// H = hurt self
	{
		TakeDamage (5);
	}
#endif

	if (Keyboard[sc_I])			// I = item cheat
	{
		extern id0_boolean_t redraw_gems;

		CenterWindow (12,3);
		US_PrintCentered ("Free items!");
		VW_UpdateScreen();
		for (i=0;i<4;i++)
		{
			GiveBolt ();
			GiveNuke ();
			GivePotion ();
//			if (!gamestate.keys[i])
				GiveKey (i);
			gamestate.gems[i] = GEM_DELAY_TIME;
		}
		gamestate.gems[4] = GEM_DELAY_TIME;
		redraw_gems = true;
		for (i=0;i<8;i++)
			GiveScroll (i,false);

		IN_Ack ();
		return 1;
	}

	if (Keyboard[sc_M])			// M = memory info
	{
		DebugMemory();
		return 1;
	}

#if DEBUG_OVERHEAD
	if (Keyboard[sc_O])			// O = overhead
	{
		ViewMap();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_P])			// P = pause with no screen disruptioon
	{
		PicturePause ();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_S])	// S = slow motion
	{
		singlestep^=1;
		CenterWindow (18,3);
		if (singlestep)
			US_PrintCentered ("Slow motion ON");
		else
			US_PrintCentered ("Slow motion OFF");
		VW_UpdateScreen();
		IN_Ack ();
		return 1;
	}
#endif

#if 0
	if (Keyboard[sc_V])			// V = extra VBLs
	{
		CenterWindow(30,3);
		PrintY+=6;
		US_Print("  Add how many extra VBLs(0-8):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=8)
				extravbls = level;
		}
		return 1;
	}
#endif

	if (Keyboard[sc_W])	// W = warp to level
	{
		CenterWindow(26,3);
		PrintY+=6;
		US_Print("  Warp to which level(0-18):");
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
			if (level>=0 && level<=LASTMAP-1)
			{
				gamestate.mapon = level;
				playstate = ex_warped;
				lasttext = -1;
			}
		}
		return 1;
	}

#if 0
	if (Keyboard[sc_X])			// X = item cheat
	{
		CenterWindow (12,3);
		US_PrintCentered ("Extra stuff!");
		VW_UpdateScreen();
		for (i=0;i<4;i++)
		{
			GiveBolt ();
			GiveNuke ();
			GivePotion ();
		}
		IN_Ack ();
		return 1;
	}
#endif

	if (LastScan >= sc_1 && LastScan <= sc_8)	// free scrolls
	{
		GiveScroll (LastScan-sc_1,false);
		IN_ClearKeysDown ();
	}

	return 0;
}
Пример #18
0
void DoEscortMenu(void)
{
	int	i;
	int	paused;
	int	next_goal;
	char	goal_str[32], tstr[32];

	if (gameData.app.nGameMode & GM_MULTI) {
		HUDInitMessage(TXT_GB_MULTIPLAYER);
		return;
	}

	for (i=0; i<=gameData.objs.nLastObject; i++) {
		if (gameData.objs.objects[i].type == OBJ_ROBOT)
			if (gameData.bots.pInfo[gameData.objs.objects[i].id].companion)
				break;
	}

	if (i > gameData.objs.nLastObject) {

#if 1//def _DEBUG - always allow buddy bot creation
		//	If no buddy bot, create one!
		HUDInitMessage (TXT_GB_CREATE);
		CreateBuddyBot();
#else
		HUDInitMessage(TXT_GB_NONE);
		return;
#endif
	}

	BuddyMayTalk();	//	Needed here or we might not know buddy can talk when he can.

	if (!gameData.escort.bMayTalk) {
		HUDInitMessage(TXT_GB_RELEASE, gameData.escort.szName);
		return;
	}

	DigiPauseDigiSounds();
	if (!gameOpts->menus.nStyle)
		StopTime();

	PaletteSave();
	apply_modified_palette();
	ResetPaletteAdd();

	GameFlushInputs();

	paused = 1;

//	SetScreenMode( SCREEN_MENU );
	SetPopupScreenMode();
	GrPaletteStepLoad( NULL );

	//	This prevents the buddy from coming back if you've told him to scram.
	//	If we don't set next_goal, we get garbage there.
	if (gameData.escort.nSpecialGoal == ESCORT_GOAL_SCRAM) {
		gameData.escort.nSpecialGoal = -1;	//	Else setting next goal might fail.
		next_goal = EscortSetGoalObject();
		gameData.escort.nSpecialGoal = ESCORT_GOAL_SCRAM;
	} else {
		gameData.escort.nSpecialGoal = -1;	//	Else setting next goal might fail.
		next_goal = EscortSetGoalObject();
	}

	switch (next_goal) {
	#ifndef NDEBUG
		case ESCORT_GOAL_UNSPECIFIED:
			Int3();
			sprintf(goal_str, "ERROR");
			break;
	#endif
			
		case ESCORT_GOAL_BLUE_KEY:
			sprintf(goal_str, TXT_GB_BLUEKEY);
			break;
		case ESCORT_GOAL_GOLD_KEY:
			sprintf(goal_str, TXT_GB_YELLOWKEY);
			break;
		case ESCORT_GOAL_RED_KEY:
			sprintf(goal_str, TXT_GB_REDKEY);
			break;
		case ESCORT_GOAL_CONTROLCEN:
			sprintf(goal_str, TXT_GB_REACTOR);
			break;
		case ESCORT_GOAL_BOSS:
			sprintf(goal_str, TXT_GB_BOSS);
			break;
		case ESCORT_GOAL_EXIT:
			sprintf(goal_str, TXT_GB_EXIT);
			break;
		case ESCORT_GOAL_MARKER1:
		case ESCORT_GOAL_MARKER2:
		case ESCORT_GOAL_MARKER3:
		case ESCORT_GOAL_MARKER4:
		case ESCORT_GOAL_MARKER5:
		case ESCORT_GOAL_MARKER6:
		case ESCORT_GOAL_MARKER7:
		case ESCORT_GOAL_MARKER8:
		case ESCORT_GOAL_MARKER9:
			sprintf(goal_str, TXT_GB_MARKER, next_goal-ESCORT_GOAL_MARKER1+1);
			break;

	}
			
	if (!gameData.escort.bMsgsSuppressed)
		sprintf(tstr, TXT_GB_SUPPRESS);
	else
		sprintf(tstr, TXT_GB_ENABLE);

	i = ShowEscortHelp (goal_str, tstr);
	if (i < 11) {
		gameData.escort.bSearchingMarker = -1;
		gameData.escort.nLastKey = -1;
		EscortSetSpecialGoal (i ? KEY_1 + i - 1 : KEY_0);
		gameData.escort.nLastKey = -1;
		paused = 0;
		}
	else if (i == 11) {
		BuddyMessage (gameData.escort.bMsgsSuppressed ? TXT_GB_MSGS_ON : TXT_GB_MSGS_OFF);
		gameData.escort.bMsgsSuppressed = !gameData.escort.bMsgsSuppressed;
		paused = 0;
		}
	GameFlushInputs();
	PaletteRestore();
	if (!gameOpts->menus.nStyle)
		StartTime();
	DigiResumeDigiSounds();
}
Пример #19
0
// ----------------------------------------------------------------------------
void write_game_text_file(char *filename)
{
	char	my_filename[128];
	int	namelen;
	FILE	* my_file;

	Errors_in_mine = 0;

	namelen = (int) strlen(filename);

	Assert (namelen > 4);

	Assert (filename[namelen-4] == '.');

	strcpy(my_filename, filename);
	strcpy( &my_filename[namelen-4], ".txm");

	my_file = fopen( my_filename, "wt" );
	if (!my_file)	{
		char  ErrorMessage[200];

		sprintf( ErrorMessage, "ERROR: Unable to open %s\nErrno = %i", my_file, errno );
		StopTime();
		GrPaletteStepLoad (NULL);
		ExecMessageBox( NULL, 1, "Ok", ErrorMessage );
		StartTime();

		return;
	}

	dump_used_texturesLevel(my_file, 0);
	sayTotals(my_file, gameData.segs.szLevelFilename);

	fprintf(my_file, "\nNumber of segments:   %4i\n", gameData.segs.nLastSegment+1);
	fprintf(my_file, "Number of gameData.objs.objects:    %4i\n", gameData.objs.nLastObject+1);
	fprintf(my_file, "Number of walls:      %4i\n", gameData.walls.nWalls);
	fprintf(my_file, "Number of open doors: %4i\n", gameData.walls.nOpenDoors);
	fprintf(my_file, "Number of triggers:   %4i\n", gameData.trigs.nTriggers);
	fprintf(my_file, "Number of matcens:    %4i\n", gameData.matCens.nBotCenters);
	fprintf(my_file, "\n");

	write_segment_text(my_file);

	write_fuelcen_text(my_file);

	write_matcen_text(my_file);

	write_player_text(my_file);

	write_wall_text(my_file);

	write_trigger_text(my_file);

	write_exit_text(my_file);

	//	---------- Find control center tSegment ----------
	write_control_center_text(my_file);

	//	---------- Show keyed walls ----------
	write_key_text(my_file);

{ int r;
	r = fclose(my_file);
#if TRACE
	con_printf (1, "Close value = %i\n", r);
#endif
	if (r)
		Int3();
}
}
Пример #20
0
void PagingTouchAllSub ()
{
	int 			bBlackScreen;

StopTime ();
bBlackScreen = gameStates.render.bPaletteFadedOut;
if (gameStates.render.bPaletteFadedOut)	{
	GrClearCanvas (BLACK_RGBA);
	GrPaletteStepLoad (NULL);
	}
//	ShowBoxedMessage (TXT_LOADING);
#if TRACE			
con_printf (CON_VERBOSE, "Loading all textures in mine...");
#endif
PagingTouchSegments ();
PagingTouchWalls ();
PagingTouchPowerups ();
PagingTouchWeapons ();
PagingTouchPowerups ();
PagingTouchGauges ();
PagingTouchVClip (&gameData.eff.vClips [0][VCLIP_PLAYER_APPEARANCE], 0);
PagingTouchVClip (&gameData.eff.vClips [0][VCLIP_POWERUP_DISAPPEARANCE], 0);
PagingTouchAddonTextures ();

#ifdef PSX_BUILD_TOOLS

//PSX STUFF
PagingTouchWalls ();
for (s = 0; s <= gameData.objs.nLastObject; s++) {
	PagingTouchObject (gameData.objs.objects + s);
	}

	{
		char * p;
		extern int gameData.missions.nCurrentLevel;
		extern ushort gameData.pig.tex.bitmapXlat [MAX_BITMAP_FILES];
		short bmUsed [MAX_BITMAP_FILES];
		FILE * fp;
		char fname [128];
		int i, bPageIn;
		grsBitmap *bmP;

		if (gameData.missions.nCurrentLevel<0)                //secret level
			strcpy (fname, gameData.missions.szSecretLevelNames [-gameData.missions.nCurrentLevel-1]);
		else                                    //normal level
			strcpy (fname, gameData.missions.szLevelNames [gameData.missions.nCurrentLevel-1]);
		p = strchr (fname, '.');
		if (p) *p = 0;
		strcat (fname, ".pag");

		fp = fopen (fname, "wt");
		for (i=0; i<MAX_BITMAP_FILES;i++)      {
			bmUsed [i] = 0;
		}
		for (i=0; i<MAX_BITMAP_FILES;i++)      {
			bmUsed [gameData.pig.tex.bitmapXlat [i]]++;
		}

		//cmp added so that .damage bitmaps are included for paged-in lights of the current level
		for (i=0; i<MAX_TEXTURES;i++) {
			if (gameData.pig.tex.pBmIndex [i].index > 0 && gameData.pig.tex.pBmIndex [i].index < MAX_BITMAP_FILES &&
				bmUsed [gameData.pig.tex.pBmIndex [i].index] > 0 &&
				gameData.pig.tex.pTMapInfo [i].destroyed > 0 && gameData.pig.tex.pTMapInfo [i].destroyed < MAX_BITMAP_FILES) {
				bmUsed [gameData.pig.tex.pBmIndex [gameData.pig.tex.pTMapInfo [i].destroyed].index] += 1;
				PIGGY_PAGE_IN (gameData.pig.tex.pBmIndex [gameData.pig.tex.pTMapInfo [i].destroyed].index);

			}
		}

		//	Force cockpit to be paged in.
		{
			tBitmapIndex bonk;
			bonk.index = 109;
			PIGGY_PAGE_IN (bonk.index);
		}

		// Force in the frames for markers
		{
			tBitmapIndex bonk2;
			bonk2.index = 2014;
			PIGGY_PAGE_IN (bonk2.index);
			bonk2.index = 2015;
			PIGGY_PAGE_IN (bonk2.index);
			bonk2.index = 2016;
			PIGGY_PAGE_IN (bonk2.index);
			bonk2.index = 2017;
			PIGGY_PAGE_IN (bonk2.index);
			bonk2.index = 2018;
			PIGGY_PAGE_IN (bonk2.index);
		}

		for (i = 0, bmP = gameData.pig.tex.pBitmaps; i < MAX_BITMAP_FILES; i++, bmP++) {
			bPageIn = 1;
			// cmp debug
			//piggy_get_bitmap_name (i,fname);

			if (!bmP->bmTexBuf || (bmP->bmProps.flags & BM_FLAG_PAGED_OUT))
				bPageIn = 0;
//                      if (gameData.pig.tex.bitmapXlat [i]!=i)
//                              bPageIn = 0;

			if (!bmUsed [i])
				bPageIn = 0;
			if ((i==47) || (i==48))               // Mark red mplayer ship textures as paged in.
				bPageIn = 1;
			if (!bPageIn)
				fprintf (fp, "0,\t// Bitmap %d (%s)\n", i, "test\0"); // cmp debug fname);
			else
				fprintf (fp, "1,\t// Bitmap %d (%s)\n", i, "test\0"); // cmp debug fname);
		}

		fclose (fp);
	}
#endif

#if TRACE			
	con_printf (CON_VERBOSE, "... loading all textures in mine done\n");
#endif
//@@	ClearBoxedMessage ();

	if (bBlackScreen)	{
		GrPaletteStepClear ();
		GrClearCanvas (BLACK_RGBA);
	}
	StartTime (0);
	ResetCockpit ();		//force cockpit redraw next time

}