/*---------------------------------------------------------------------------- HandleCount ----------------------------------------------------------------------------*/ void AEGenericClass::HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply) { ConstAETokenDesc tokenDesc(token); long numberOfObjects = 0; DescType objectClass; OSErr err = noErr; if (!reply->dataHandle) return; // Get the class of object that we will count err = GetObjectClassFromAppleEvent(appleEvent, &objectClass); ThrowIfOSErr(err); err = CheckForUnusedParameters(appleEvent); ThrowIfOSErr(err); if (AEListUtils::TokenContainsTokenList(token)) { err = AECountItems(token, &numberOfObjects); ThrowIfOSErr(err); } else { CountObjects(objectClass, tokenDesc.GetDispatchClass(), token, &numberOfObjects); } err = AEPutParamPtr(reply, keyAEResult, typeLongInteger, (Ptr)&numberOfObjects, sizeof(long)); ThrowIfOSErr(err); }
// Save/load void CPhysicsMotionController::WriteToTemplate( vphysics_save_motioncontroller_t &controllerTemplate ) { controllerTemplate.m_nPriority = m_priority; int nObjectCount = CountObjects(); controllerTemplate.m_objectList.AddMultipleToTail( nObjectCount ); GetObjects( controllerTemplate.m_objectList.Base() ); }
void CCountGroupBox::Draw(HDC dc) { CGroupBox::Draw(dc); SetTextColor(dc,RGB(255,255,255)); SetBkMode(dc,TRANSPARENT); int a=CountObjects(type); static CHAR c[50]; sprintf(&c[0],M_ANZAHL,a); TextOut(dc,10,25,&c[0],strlen(&c[0])); }
// Geometrie nicht modifizieren, nur Merkmale/Ident korrigieren --------------- bool UpdateFeatures (HPROJECT hPr, LONG &rlONr, ULONG lIdent, long sta[], long mi[]) { // Objekt wiederfinden char *pUIdent = NULL; rlONr = 0L; TX_ASSERT(!(g_fAbglGeom && g_fAbglAttr)); // nie gleichzeitig Attribs und Geometrie abgleichen! // versuchen über GUID zu finden if ('\0' != guid[0]) { OBJECTGUID OUID; INITSTRUCT (OUID, OBJECTGUID); if (SUCCEEDED(CLSIDFromString (WideString(guid), &OUID.guid))) { if (SUCCEEDED(DEX_FindObjectFromGuidEx (hPr, OUID))) rlONr = OUID.lONr; } } // versuchen, über Unique Ident zu finden if (0 == rlONr && RetrieveText (g_ulUniqueId, mi, &pUIdent, false, !g_fImportObj) > 0) rlONr = FindObject (g_ulUniqueId, pUIdent); DELETE_OBJ(pUIdent); if (rlONr > 0) { // Merkmale erzeugen if (m_flag && !CreateFeatures (rlONr, mi, lIdent)) { g_lWithErrors++; // mit Fehlern importiert return false; } ULONG lOldId = (ULONG)DEX_GetObjIdent (rlONr); if (lIdent != lOldId) { MODOBJIDENT MOI; INITSTRUCT(MOI, MODOBJIDENT); MOI.lONr = rlONr; MOI.lNewIdent = lIdent; MOI.iMode = 0; if (!DEX_ModObjectIdent (MOI)) { g_lWithErrors++; // mit Fehlern importiert return false; } } CountObjects (sta[1]); return true; } else g_lNotImported++; // nicht wiedergefunden return false; }
bool _LikelihoodFunction::ProcessPartitionList (_SimpleList& partsToDo, _Matrix* partitionList, _String caller) { long partCount = CountObjects(0); partsToDo.Populate (partCount, 0, 1); if (partitionList) { partitionList->ConvertToSimpleList (partsToDo); DeleteObject (partitionList); partsToDo.Sort(); partsToDo.FilterRange (-1, partCount); if (partsToDo.lLength == 0) { WarnError (_String("An invalid partition specification in call to ") & caller); return nil; } } return true; }
void CImage::EditUndo( BOOL fEditUndo, BOOL fMaskUndo, LPUPDATE_TYPE lpUpdateType, LPRECT lpUpdateRect) { RECT rUndo, rUndoMask, rTemp; LPOBJECT lpBase, lpObject, lpNext; BOOL fNewSize, fSetupMiniViews, fRemoveMarquee, fUndoDelete, fColorMapChanged; BOOL fUndoAlpha, fUndoData; int nDeleted; LPMASK lpMask; EDIT_TARGET Target; AstralSetRectEmpty(lpUpdateRect); // Initialize things for updating the display fNewSize = fSetupMiniViews = fUndoDelete = fColorMapChanged = NO; AstralSetRectEmpty(&rUndo); AstralSetRectEmpty(&rUndoMask); // loop through objects doing undo lpBase = GetBase(); lpObject = NULL; // get the target of the last edit Target = EditTarget; while (lpObject = GetNextObject(lpObject, NO, NO, fEditUndo)) { // See if this is an object we are undoing if (fEditUndo) { // check for special undo processing of a deleted object if (lpObject->fDeleted) continue; // do no undo processing for a deleted object // { // if (Control.UndoObjects && !IsSelectedObject(lpBase)) // continue; // } else // if target is not the entire image and we are in undo // object mode and the object is not selected then // skip this object if (Target != ET_ALLOBJECTS && Control.UndoObjects && !IsSelectedObject(lpObject)) continue; } // Only handle mask undo for the base object if (fMaskUndo) { if (lpObject != lpBase || lpObject->fBothDirty || !lpObject->AlphaDirty) continue; } fUndoData = fUndoAlpha = NO; // Do preprocess for doing a data undo if (fEditUndo) { if (lpObject->DataDirty) fUndoData = YES; // See if we need to undo the alpha for this object if ((lpObject != lpBase) && lpObject->lpAlpha && lpObject->AlphaDirty) fUndoAlpha = YES; if (!fUndoData && !fUndoAlpha) continue; // check to see and undoing/redoing deleted objects will change // the select state, if so undraw the object marquee if (lpObject == lpBase && lpObject->DataUndoType & UT_DELETEOBJECTS) { fUndoDelete = YES; fRemoveMarquee = NO; nDeleted = 0; lpNext = lpObject; while (lpNext = GetNextObject(lpNext, YES, NO, YES)) { if (lpNext->fUndoDeleted) ++nDeleted; else if (lpNext->fDeleted && lpNext->fSelected) { fRemoveMarquee = YES; break; } } if (GetSelObject(NULL) == lpBase && !fRemoveMarquee) { if (CountObjects() - nDeleted <= 1) fRemoveMarquee = YES; } if (fRemoveMarquee) { GetObjectMarqueeRect(this, &rTemp); AstralUnionRect(lpUpdateRect, lpUpdateRect, &rTemp); } } } else // fMaskUndo if (!lpObject->AlphaDirty) continue; else fUndoAlpha = YES; // do a preprocess for undoing the mask caused either by // a mask undo or by an edit function that also edits the mask if (((lpObject == lpBase) && fEditUndo && lpObject->fBothDirty) || fMaskUndo) { if ( lpObject->AlphaUndoType & (UT_CREATEMASK|UT_DELETEMASK) ) { // if the undo is going to delete the mask, // we need to undraw the mask if (GetMask()) { GetMaskMarqueeRect(this, &rTemp); AstralUnionRect(lpUpdateRect, lpUpdateRect, &rTemp); if (GetMaskUpdateRect(YES, NO, &rTemp)) AstralUnionRect(&rUndoMask, &rUndoMask, &rTemp); } // if the undo is going to create the mask, // we need to undraw the object marquees if // not in mask and object marquee mode else { if (!Control.UseMaskAndObjects) { GetObjectMarqueeRect(this, &rTemp); AstralUnionRect(lpUpdateRect, lpUpdateRect, &rTemp); } } } } // Actually do the undo ObjEditUndo(lpObject, fUndoData, fUndoAlpha); // do a postprocess for undoing the mask if ((lpMask = GetMask()) && (((lpObject == lpBase) && fEditUndo && lpObject->fBothDirty) || fMaskUndo)) { // if the undo is going to add the mask, we need to redraw the mask if (lpObject->AlphaUndoType & (UT_CREATEMASK|UT_DELETEMASK) ) { if (GetMaskUpdateRect(YES, NO, &rTemp)) AstralUnionRect(&rUndoMask, &rUndoMask, &rTemp); } else // just redraw the undo area for the mask AstralUnionRect(&rUndoMask, &rUndoMask, &lpMask->Pixmap.UndoRect); } // Setup rectangle for undoing deletion of objects // Handled specially so that moved objects will still undo // and redo properly if (fEditUndo) { if (lpObject == lpBase && lpObject->DataUndoType & UT_DELETEOBJECTS) { lpNext = lpObject; while (lpNext = GetNextObject(lpNext, YES, NO, YES)) { if (lpNext->fDeleted || lpNext->fUndoDeleted) AstralUnionRect(&rUndo, &rUndo, &lpNext->rObject); } fSetupMiniViews = YES; } if (lpObject->DataUndoType & UT_COLORMAP) fColorMapChanged = YES; if (lpObject->Pixmap.fNewFrame) { /* if new frame, cause window to be redisplayed */ if (lpObject == lpBase) fNewSize = YES; else { if (!fNewSize) { AstralUnionRect(&rUndo, &rUndo, &lpObject->rObject); AstralUnionRect(&rUndo, &rUndo, &lpObject->rUndoObject); } } } else { AstralSetRectEmpty(&rTemp); if (fUndoData) AstralUnionRect(&rTemp, &rTemp, &lpObject->Pixmap.UndoRect); if (fUndoAlpha) AstralUnionRect(&rTemp, &rTemp, &lpObject->lpAlpha->Pixmap.UndoRect); if (rTemp.right >= rTemp.left) { if (!fNewSize) { OffsetRect(&rTemp, lpObject->rObject.left, lpObject->rObject.top); AstralUnionRect(&rUndo, &rUndo, &rTemp); } } if( lpObject->DataUndoType & UT_OBJECTRECT ) { AstralUnionRect( &rUndo, &rUndo, &lpObject->rObject ); AstralUnionRect( &rUndo, &rUndo, &lpObject->rUndoObject ); } } } } // now redisplay whatever changes are necessary for the undo if (fColorMapChanged) { ImgColorMapChanged(this); *lpUpdateType |= UT_DATATYPE; } if (fNewSize) { *lpUpdateType |= UT_DATATYPE; if (lpBase->Pixmap.UndoFrame) { if ((FrameXSize(lpBase->Pixmap.UndoFrame) == FrameXSize(lpBase->Pixmap.EditFrame)) && (FrameYSize(lpBase->Pixmap.UndoFrame) == FrameYSize(lpBase->Pixmap.EditFrame))) fNewSize = NO; } if (fNewSize) *lpUpdateType |= UT_SIZE; else { int dx, dy; GetInfo(&dx, &dy, NULL, NULL); SetRect(lpUpdateRect, 0, 0, dx-1, dy-1); } } else { if (!AstralIsRectEmpty(lpUpdateRect)) *lpUpdateType |= UT_ACTIVEAREA; if (rUndoMask.right >= rUndoMask.left) { *lpUpdateType |= UT_ACTIVEAREA; AstralUnionRect(lpUpdateRect, lpUpdateRect, &rUndoMask); } if (rUndo.right >= rUndo.left) { *lpUpdateType |= UT_AREA; AstralUnionRect(lpUpdateRect, lpUpdateRect, &rUndo); } } }
int DebugKeys() { boolean esc; int level; if (IN_KeyDown(sc_C)) // C = count objects { CountObjects(); return 1; } if (IN_KeyDown(sc_E)) // E = quit level { playstate = ex_completed; // gamestate.mapon++; } if (IN_KeyDown(sc_F)) // F = facing spot { CenterWindow (14,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("\nY:"); US_PrintUnsigned (player->y); US_Print ("\nA:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } if (IN_KeyDown(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 (IN_KeyDown(sc_H)) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (IN_KeyDown(sc_I)) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); GivePoints(100000); HealSelf(99); if (gamestate.bestweapon<wp_chaingun) GiveWeapon (gamestate.bestweapon+1); gamestate.ammo += 50; if (gamestate.ammo > 99) gamestate.ammo = 99; DrawAmmo (); IN_Ack (); return 1; } else if (IN_KeyDown(sc_N)) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (IN_KeyDown(sc_P)) // P = pause with no screen disruptioon { PicturePause (); return 1; } else if (IN_KeyDown(sc_Q)) // Q = fast quit Quit(NULL); else if (IN_KeyDown(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; } else if (IN_KeyDown(sc_T)) // T = shape test { ShapeTest(); return 1; } else if (IN_KeyDown(sc_W)) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10):"); #elif defined(SPEARDEMO) US_Print(" Warp to which level(1-2):"); #else US_Print(" Warp to which level(1-21):"); #endif VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); #ifndef SPEAR if (level>0 && level<11) #elif defined(SPEARDEMO) if (level>0 && level<2) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } DrawPlayBorder(); return 0; }
bool CreateObject (LONG &rlONr, ULONG lIdent, long sta[], long mi[], long lgi, double gxi[], double gyi[]) { HPROJECT hPr = DEX_GetDataSourceHandle(); _ASSERTE(NULL != hPr); if (sta[0] == K_OBJEKT) return r_flag ? CreateKomplexObject (hPr, rlONr, lIdent, mi) : true; // Objekt erzeugen oder wiederfinden, Geometrie schreiben long lONr = 0L; char *pUIdent = NULL; TX_ASSERT(!(g_fAbglGeom && g_fAbglAttr)); // nie gleichzeitig Attribs und Geometrie abgleichen! if (!m_flag || g_fAbglOks || g_fAbglGeom || g_fAbglAttr || 0 != g_ulOksToAttr) { // versuchen über GUID zu finden if ('\0' != guid[0]) { OBJECTGUID OUID; INITSTRUCT (OUID, OBJECTGUID); if (SUCCEEDED(CLSIDFromString (WideString(guid), &OUID.guid))) { if (SUCCEEDED(DEX_FindObjectFromGuid (OUID))) lONr = OUID.lONr; } } // versuchen, über Unique Ident zu finden if (0 == lONr && RetrieveText (g_ulUniqueId, mi, &pUIdent, false, !g_fImportObj) > 0) lONr = FindObject (g_ulUniqueId, pUIdent); } DELETE_OBJ(pUIdent); TEXTGEOMETRIEEX TG; OBJGEOMETRIE *pOG = (OBJGEOMETRIE *)&TG; ULONG lIgnore = 0L; int iFlags = OGForceGeometry|OGNoMemoryObject|OGConverted; bool fRet = true; if (0 == lONr) { // nicht wiedergefunden // Objekt neu erzeugen iFlags |= OGNewObject; fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore); } else { // Abgleich durchführen if (g_fAbglGeom) { // Geometrie abgleichen iFlags |= OGModObject; fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore); } else { // bisherigen Oks wegschreiben if (0 != g_ulOksToAttr) { long lOldIdent = DEX_GetObjIdent(lONr); char cbOKS[MAX_OKS_LENX+1]; if (S_OK == ClassFromIdentX (lOldIdent, cbOKS)) WriteTextMerkmal (lONr, (ULONG)g_ulOksToAttr, cbOKS, strlen(cbOKS)); } // Oks abgleichen if (g_fAbglOks) { if (0 == g_ulOksFromAttr) { // Oks vom EingabeOks nehmen MODOBJIDENT MOI; INITSTRUCT(MOI, MODOBJIDENT); MOI.lONr = lONr; MOI.lNewIdent = lIdent; MOI.iMode = GetMOIMode (sta); DEX_ModObjectIdent(MOI); } else { // Oks aus EingabeAttribut verwenden char *pOks = NULL; if (RetrieveText (g_ulOksFromAttr, mi, &pOks, false, !g_fImportObj) > 0) { // Ident über Oks besorgen long lNewIdent = 0; HRESULT hr = IdentFromClassX (hPr, pOks, (ULONG *)&lNewIdent); if (S_FALSE == hr) { ErrCode RC = IdentIsDefined(lNewIdent); if (RC != EC_OKAY && !DEX_isIdentUsedEx(hPr, lNewIdent)) // neu erzeugen, wenn keine Objekte mit diesem Ident existieren hr = IdentFromClassX (hPr, pOks, (ULONG *)&lNewIdent, true); } if (0 != lNewIdent) { // jetzt Ident modifizieren MODOBJIDENT MOI; INITSTRUCT(MOI, MODOBJIDENT); MOI.lONr = lONr; MOI.lNewIdent = lNewIdent; MOI.iMode = GetMOIMode (sta); DEX_ModObjectIdent(MOI); lIdent = lNewIdent; } } DELETE_OBJ(pOks); } } // evtl. doch noch neues Objekt erzeugen if (g_fImportObj) { iFlags |= OGNewObject; fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore); } else rlONr = lONr; } } if (!fRet) { if (0 == pOG -> lONr) { g_lNotImported++; return false; } else { if (pOG -> iFlags & OGObjectHasGeometryErrors) g_lWithErrors++; // mit Fehlern importiert } } CountObjects (sta[1]); // Objekte zählen // Merkmale erzeugen if (m_flag || g_fAbglAttr) return CreateFeatures (rlONr, mi, lIdent, lIgnore); return true; }
int DebugKeys (void) { boolean esc; int level; if (Keyboard[sc_B]) // B = border color { CenterWindow(20,3); PrintY+=6; US_Print(" Border color (0-56): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=99) { if (level<30) level += 31; else { if (level > 56) level=31; else level -= 26; } bordercol=level*4+3; if (bordercol == VIEWCOLOR) DrawStatusBorder(bordercol); DrawPlayBorder(); return 0; } } return 1; } if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = Darkone's FPS counter { CenterWindow (22,2); if (fpscounter) US_PrintCentered ("Darkone's FPS Counter OFF"); else US_PrintCentered ("Darkone's FPS Counter ON"); VW_UpdateScreen(); IN_Ack(); fpscounter ^= 1; /* if (!fpscounter) DrawPlayScreen(); */ return 1; } if (Keyboard[sc_E]) // E = quit level { if (param_tedlevel != -1) Quit (NULL); playstate = ex_completed; } if (Keyboard[sc_F]) // F = facing spot { char str[60]; CenterWindow (14,6); US_Print ("x:"); US_PrintUnsigned (player->x); US_Print (" ("); US_PrintUnsigned (player->x%65536); US_Print (")\ny:"); US_PrintUnsigned (player->y); US_Print (" ("); US_PrintUnsigned (player->y%65536); US_Print (")\nA:"); US_PrintUnsigned (player->angle); US_Print (" X:"); US_PrintUnsigned (player->tilex); US_Print (" Y:"); US_PrintUnsigned (player->tiley); US_Print ("\n1:"); US_PrintUnsigned (tilemap[player->tilex][player->tiley]); sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str); US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber); US_Print (" 2:"); US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1)); US_Print (" 3:"); if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256) US_PrintUnsigned (spotvis[player->tilex][player->tiley]); else US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags); VW_UpdateScreen(); IN_Ack(); return 1; } if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode == 0) US_PrintCentered ("God mode ON"); else if (godmode == 1) US_PrintCentered ("God (no flash)"); else if (godmode == 2) US_PrintCentered ("God mode OFF"); VW_UpdateScreen(); IN_Ack(); if (godmode != 2) godmode++; else godmode = 0; return 1; } if (Keyboard[sc_H]) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (Keyboard[sc_I]) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); GivePoints (100000); HealSelf (99); if (gamestate.bestweapon<wp_chaingun) GiveWeapon (gamestate.bestweapon+1); gamestate.ammo += 50; if (gamestate.ammo > 99) gamestate.ammo = 99; DrawAmmo (); IN_Ack (); return 1; } else if (Keyboard[sc_K]) // K = give keys { CenterWindow(16,3); PrintY+=6; US_Print(" Give Key (1-4): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,1,0); if (!esc) { level = atoi (str); if (level>0 && level<5) GiveKey(level-1); } return 1; } else if (Keyboard[sc_L]) // L = level ratios { byte x,start,end=LRpack; if (end == 8) // wolf3d { CenterWindow(17,10); start = 0; } else // sod { CenterWindow(17,12); start = 0; end = 10; } again: for(x=start;x<end;x++) { US_PrintUnsigned(x+1); US_Print(" "); US_PrintUnsigned(LevelRatios[x].time/60); US_Print(":"); if (LevelRatios[x].time%60 < 10) US_Print("0"); US_PrintUnsigned(LevelRatios[x].time%60); US_Print(" "); US_PrintUnsigned(LevelRatios[x].kill); US_Print("% "); US_PrintUnsigned(LevelRatios[x].secret); US_Print("% "); US_PrintUnsigned(LevelRatios[x].treasure); US_Print("%\n"); } VW_UpdateScreen(); IN_Ack(); if (end == 10 && gamestate.mapon > 9) { start = 10; end = 20; CenterWindow(17,12); goto again; } return 1; } else if (Keyboard[sc_N]) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[sc_O]) // O = basic overhead { BasicOverhead(); return 1; } /*else if(Keyboard[sc_P]) // P = Ripper's picture grabber { PictureGrabber(); return 1; } */ else if (Keyboard[sc_Q]) // Q = fast quit Quit (NULL); else if (Keyboard[sc_S]) // S = slow motion { CenterWindow(30,3); PrintY+=6; US_Print(" Slow Motion steps (default 14): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=50) singlestep = level; } return 1; } else if (Keyboard[sc_T]) // T = shape test { ShapeTest (); return 1; } else 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,1,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } else if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10): "); #else US_Print(" Warp to which level(1-21): "); #endif VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); #ifndef SPEAR if (level>0 && level<11) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } else if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); // DEBUG: put stuff here IN_Ack (); return 1; } #ifdef USE_CLOUDSKY else if(Keyboard[sc_Z]) { char defstr[15]; CenterWindow(34,4); PrintY+=6; US_Print(" Recalculate sky with seek: "); int seekpx = px, seekpy = py; US_PrintUnsigned(curSky->seed); US_Print("\n Use color map (0-"); US_PrintUnsigned(numColorMaps - 1); US_Print("): "); int mappx = px, mappy = py; US_PrintUnsigned(curSky->colorMapIndex); VW_UpdateScreen(); sprintf(defstr, "%u", curSky->seed); esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0); if(esc) return 0; curSky->seed = (uint32_t) atoi(str); sprintf(defstr, "%u", curSky->colorMapIndex); esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0); if(esc) return 0; uint32_t newInd = (uint32_t) atoi(str); if(newInd < (uint32_t) numColorMaps) { curSky->colorMapIndex = newInd; InitSky(); } else { CenterWindow (18,3); US_PrintCentered ("Illegal color map!"); VW_UpdateScreen(); IN_Ack (); } } #endif return 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; }
void SCENE::SetupDummies() { bool Lighting=true; //na ez lovi be a scene display listjeit ObjDummyCount=CountObjects(); ObjDummies=new OBJDUMMY[ObjDummyCount]; memset(ObjDummies,0,sizeof(OBJDUMMY)*ObjDummyCount); //dummy tomb int FilledDummy=0; int x; for (x=0; x<ObjectNum; x++) //dummy tomb feltoltese { if (ObjectList[x].Primitive<100 && ObjectList[x].Primitive!=11 /*clone*/) CalculateDummy(&ObjectList[x],FilledDummy,&ObjectList[x].ModelView); if (ObjectList[x].Primitive==11 /*clone*/) SetupClones(this,x,FilledDummy,&ObjectList[x].ModelView); } qsort(ObjDummies,ObjDummyCount,sizeof(OBJDUMMY),DummyCompare); //attributumsort glNewList(ZmaskList,GL_COMPILE); //ket lista keszul, egy a zmaskos objecteknek, egy a nem zmaskosoknak //ez a zmaskos, a nem zmaskos a valtaskor kap erteket glBegin(GL_TRIANGLES); unsigned char c[4],o[4]; for (x=0; x<4; x++) c[x]=o[x]=2; for (int z=0; z<ObjDummyCount; z++) //a fo loop { //glErrorCheck(); OBJECT *LastObject=NULL; if (z) LastObject=ObjDummies[z-1].OriginalObj; //ez az elozo object, referencianak h melyik //attributum valtozott OBJECT *Object=ObjDummies[z].OriginalObj; //az aktualis object //MATRIX Position; //memcpy(&Position,ObjDummies[z].ModelView,sizeof(MATRIX)); //az object pozicioja /*MATRIX InvTransp; memcpy(&InvTransp,&Position,sizeof(MATRIX)); M_Invert(InvTransp); M_Transpose(InvTransp);*/ //eltranszformaljuk az osszes vertexet a vegleges pozicioba, es kiszamoljuk a normalokat, //erre azert van szukseg mert igy jok lesznek a normalok es a nonuniform scalezettek nem bugzanak be for (x=0; x<Object->VertexNum; x++) { Object->VertexList[x].MapTransformedPosition=Object->VertexList[x].Position; M_Xformd(ObjDummies[z].ModelView,Object->VertexList[x].MapTransformedPosition,Object->VertexList[x].MapTransformedPosition); } Object->CalculateNormals(); //ha szinvaltozas van bool NewCol=!LastObject; if (!ColorDiscard && LastObject) for (int a=0; a<4; a++) if (Object->Color.c[a]!=LastObject->Color.c[a]) NewCol=true; bool Cut; //ha elertunk a zmask valtashoz bool ZmaskChange=!Object->ZMask && (!LastObject || LastObject->ZMask); NewCol=ZmaskChange || NewCol; //ha envmap objecthez ertunk bool EnvmapTurnOn=((LastObject && !ObjDummies[z-1].Envmap) || !LastObject) && ObjDummies[z].Envmap; //ha wireframe valtas van //bool WireframeChange=!LastObject || ZmaskChange || EnvmapTurnOn || (Object->Wireframe != LastObject->Wireframe); //ha kikapcsolodott a textura bool TextureDisable=(!Object->Textured && ((LastObject && LastObject->Textured) || !LastObject));// || (WireframeChange && Object->Wireframe && !ObjDummies[z].Envmap); //ha valtozott a textura bool TextureChange=Object->Textured && (ZmaskChange || (!LastObject || !LastObject->Textured) || (LastObject && LastObject->Material->TextureID*8+LastObject->Material->SlotNumber!=Object->Material->TextureID*8+Object->Material->SlotNumber));// || (WireframeChange && !Object->Wireframe && Object->Textured)); //ha valtozott a blendmode bool BlendChange=!LastObject || LastObject->SRCBlend!=Object->SRCBlend || LastObject->DSTBlend!=Object->DSTBlend; //ha valtozott az envmap bool EnvmapChange=Object->EnvMap && LastObject && ObjDummies[z-1].Envmap && (LastObject->EnvMap->TextureID*8+LastObject->EnvMap->SlotNumber!=Object->EnvMap->TextureID*8+Object->EnvMap->SlotNumber); //ha valtozott a backface culling ki be kapcsoltsaga bool BackChange=!LastObject || ZmaskChange || (Object->Backface != LastObject->Backface); //ha valtozott a backface culling iranya bool BackFrontChange=!LastObject || ZmaskChange || (Object->Backface && Object->Backfront!=LastObject->Backfront); //ha valtozott az alpha epsilon bool AepsilonChange=!LastObject || ZmaskChange || (Object->AEpsilon != LastObject->AEpsilon); //ha meg kell szakitani modvaltas miatt a glbegin() glend()-et Cut=ZmaskChange || (!ObjDummies[z].Envmap && (TextureDisable || TextureChange || BlendChange) ) || (ObjDummies[z].Envmap && (EnvmapTurnOn || EnvmapChange)) || (NewCol && !ColorDiscard) || BackChange || BackFrontChange || AepsilonChange; //||WireframeChange; //ha meg kell szakitani, akkor megszakitjuk :) if (Cut) glEnd(); //zmask valtas, innen a nem zmaskos objectek jonnek (kulon listaba mert egy world tobb scenebol //allhat, es eloszor a zmaskos scene listakat kell renderelni, utana a nem zmaskosakat) if (ZmaskChange) { glEndList(); glNewList(NoZmaskList,GL_COMPILE); } //alpha epsilon valtas if (AepsilonChange) { glAlphaFunc(GL_GEQUAL,Object->AEpsilon/255.0f); } //szinvaltas if (!ColorDiscard && NewCol) glColor4ub(Object->Color.c[0],Object->Color.c[1],Object->Color.c[2],Object->Color.c[3]); //backface cull ki/bekapcs if (BackChange) if (Object->Backface) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); //backface cull reverse if (BackFrontChange) if (Object->Backfront) glCullFace(GL_FRONT); else glCullFace(GL_BACK); //ha nem envmap az object if (!ObjDummies[z].Envmap) { //textura kikapcs if (TextureDisable) glDisable(GL_TEXTURE_2D); //texturavaltas if (TextureChange) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,Object->Material->ImageData.TextureHandle); } //blendmodevaltas if (BlendChange) glBlendFunc(Object->DSTBlend,Object->SRCBlend); } else //ha envmap az object { //envmap bekapcs if (EnvmapTurnOn) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,Object->EnvMap->ImageData.TextureHandle); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glBlendFunc(GL_ONE,GL_ONE); } //envmap textura valtas if (EnvmapChange) glBindTexture(GL_TEXTURE_2D,Object->EnvMap->ImageData.TextureHandle); } /*if (WireframeChange) { if (!Object->Wireframe || ObjDummies[z].Envmap) { if (Lighting) glEnable(GL_LIGHTING); } else { Lighting=glIsEnabled(GL_LIGHTING)!=0; glDisable(GL_LIGHTING); } }*/ //ha vagas volt, ujra kell glbegin if (Cut) if (!Object->Wireframe || ObjDummies[z].Envmap) glBegin(GL_TRIANGLES); else glBegin(GL_LINES); if (!Object->Wireframe || ObjDummies[z].Envmap) { for (x=0; x<Object->PolygonNum; x++) { if (Object->PolygonList[x].CurrentShading!=aDDict_GOURAUDSHADE) glNormal3f(Object->PolygonList[x].CurrentNormal.x,Object->PolygonList[x].CurrentNormal.y,Object->PolygonList[x].CurrentNormal.z); //vertex1 if (Object->PolygonList[x].CurrentShading==aDDict_GOURAUDSHADE) glNormal3f(Object->VertexList[Object->PolygonList[x].v[0]].CurrentNormal.x,Object->VertexList[Object->PolygonList[x].v[0]].CurrentNormal.y,Object->VertexList[Object->PolygonList[x].v[0]].CurrentNormal.z); if (Object->Textured) glTexCoord2f(Object->PolygonList[x].ct[0].x,Object->PolygonList[x].ct[0].y); glVertex3f(Object->VertexList[Object->PolygonList[x].v[0]].MapTransformedPosition.x,Object->VertexList[Object->PolygonList[x].v[0]].MapTransformedPosition.y,Object->VertexList[Object->PolygonList[x].v[0]].MapTransformedPosition.z); //vertex2 if (Object->PolygonList[x].CurrentShading==aDDict_GOURAUDSHADE) glNormal3f(Object->VertexList[Object->PolygonList[x].v[1]].CurrentNormal.x,Object->VertexList[Object->PolygonList[x].v[1]].CurrentNormal.y,Object->VertexList[Object->PolygonList[x].v[1]].CurrentNormal.z); if (Object->Textured) glTexCoord2f(Object->PolygonList[x].ct[1].x,Object->PolygonList[x].ct[1].y); glVertex3f(Object->VertexList[Object->PolygonList[x].v[1]].MapTransformedPosition.x,Object->VertexList[Object->PolygonList[x].v[1]].MapTransformedPosition.y,Object->VertexList[Object->PolygonList[x].v[1]].MapTransformedPosition.z); //vertex3 if (Object->PolygonList[x].CurrentShading==aDDict_GOURAUDSHADE) glNormal3f(Object->VertexList[Object->PolygonList[x].v[2]].CurrentNormal.x,Object->VertexList[Object->PolygonList[x].v[2]].CurrentNormal.y,Object->VertexList[Object->PolygonList[x].v[2]].CurrentNormal.z); if (Object->Textured) glTexCoord2f(Object->PolygonList[x].ct[2].x,Object->PolygonList[x].ct[2].y); glVertex3f(Object->VertexList[Object->PolygonList[x].v[2]].MapTransformedPosition.x,Object->VertexList[Object->PolygonList[x].v[2]].MapTransformedPosition.y,Object->VertexList[Object->PolygonList[x].v[2]].MapTransformedPosition.z); } /*if (ObjDummies[z].Envmap) { glEnd(); glColor4f(0,1,0,1); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); glDisable(GL_TEXTURE_2D); glBlendFunc(GL_ONE,GL_ZERO); glDisable(GL_LIGHTING); glBegin(GL_LINES); for (x=0; x<Object->VertexNum; x++) { glVertex3f(Object->VertexList[x].MapTransformedPosition.x,Object->VertexList[x].MapTransformedPosition.y,Object->VertexList[x].MapTransformedPosition.z); glVertex3f(Object->VertexList[x].MapTransformedPosition.x+Object->VertexList[x].CurrentNormal.x/5.0f, Object->VertexList[x].MapTransformedPosition.y+Object->VertexList[x].CurrentNormal.y/5.0f, Object->VertexList[x].MapTransformedPosition.z+Object->VertexList[x].CurrentNormal.z/5.0f); } glEnd(); } glBegin(GL_TRIANGLES);*/ } else { glEnd(); glPushAttrib(GL_LIGHTING_BIT); glPushAttrib(GL_TEXTURE_BIT); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glBegin(GL_LINES); for (x=0; x<Object->EdgeNum; x++) if (Object->EdgeList[x].InWireframe) { glVertex3f(Object->VertexList[Object->EdgeList[x].v1].MapTransformedPosition.x,Object->VertexList[Object->EdgeList[x].v1].MapTransformedPosition.y,Object->VertexList[Object->EdgeList[x].v1].MapTransformedPosition.z); glVertex3f(Object->VertexList[Object->EdgeList[x].v2].MapTransformedPosition.x,Object->VertexList[Object->EdgeList[x].v2].MapTransformedPosition.y,Object->VertexList[Object->EdgeList[x].v2].MapTransformedPosition.z); } glEnd(); glPopAttrib(); glPopAttrib(); glBegin(GL_LINES); } } //ha elertunk minden vegere, lezarjuk a stuffot glEnd(); glEndList(); }
bool CSceneEndCondition::CheckLost() { int nb = CountObjects(); return nb <= this->lost; }
bool CSceneCondition::Check() { int nb = CountObjects(); return nb >= this->min && nb <= this->max; }
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; }
id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level,i; 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; } #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 (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } 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; } 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 (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } else if (Keyboard[sc_I]) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); if (!gamestate.keys[i]) GiveKey (i); } for (i=0;i<8;i++) GiveScroll (i,false); IN_Ack (); return 1; } else if (Keyboard[sc_M]) // M = memory info { DebugMemory(); return 1; } else if (Keyboard[sc_O]) // O = overhead { ViewMap(); return 1; } else if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } else 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; } else if (Keyboard[sc_S]) // T = shape test { ShapeTest (); return 1; } else 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; } else if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(1-21):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>0 && level<21) { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } else 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; } else if (Keyboard[sc_Z]) // Z = game over { } else if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls { GiveScroll (LastScan-sc_1,false); IN_ClearKeysDown (); } return 0; }