BOOL PinBinary::LoadToken(int id, BiffReader *pbr) { if (id == FID(NAME)) { pbr->GetString(m_szName); } else if (id == FID(INME)) { pbr->GetString(m_szInternalName); } else if (id == FID(PATH)) { pbr->GetString(m_szPath); } else if (id == FID(SIZE)) { pbr->GetInt(&m_cdata); m_pdata = new char[m_cdata]; } else if (id == FID(DATA)) { // Size must come before data, otherwise our structure won't be allocated pbr->GetStruct(m_pdata, m_cdata); } return fTrue; }
void IN_DrawYAH() { FR_SetFont(FID(GF_FONTA)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", 160, 10, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColor(defFontRGB[0], defFontRGB[1], defFontRGB[2]); FR_DrawTextXY3(G_MapTitle(&wbs->nextMap).toUtf8().constData(), 160, 20, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Color4f(1, 1, 1, 1); uint const nextMap = G_MapNumberFor(wbs->nextMap); for(uint i = 0; i < nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } if(!(interTime & 16) || interState == 3) { // Draw the destination 'X' GL_DrawPatch(dpGoingThere, &YAHspot[::gameEpisode][nextMap]); } }
void IN_DrawYAH(void) { uint i; FR_SetFont(FID(GF_FONTA)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", 160, 10, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColor(defFontRGB[0], defFontRGB[1], defFontRGB[2]); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->nextMap), 160, 20, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } if(!(interTime & 16) || interState == 3) { // Draw the destination 'X' GL_DrawPatch(dpGoingThere, &YAHspot[wbs->episode][wbs->nextMap]); } }
HRESULT ISelect::SaveData(IStream *pstm, HCRYPTHASH hcrypthash, HCRYPTKEY hcryptkey) { BiffWriter bw(pstm, hcrypthash, hcryptkey); bw.WriteBool(FID(LOCK), m_fLocked); bw.WriteInt(FID(LAYR), layerIndex); return S_OK; }
BOOL ISelect::LoadToken(int id, BiffReader *pbr) { if (id == FID(LOCK)) { pbr->GetBool(&m_fLocked); } if (id == FID(LAYR)) { pbr->GetInt(&layerIndex); } return fTrue; }
void IN_DrawOldLevel(void) { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1],defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); if(wbs->currentMap == 8) { uint i; DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } } else { uint i; DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->currentMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][wbs->currentMap]); } } DGL_Disable(DGL_TEXTURE_2D); }
void IN_DrawOldLevel() { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(G_MapTitle(&wbs->currentMap).toUtf8().constData(), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1],defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); if(G_MapNumberFor(wbs->currentMap) == 8) { DGL_Color4f(1, 1, 1, 1); uint const nextMap = G_MapNumberFor(wbs->nextMap); for(uint i = 0; i < nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } } else { DGL_Color4f(1, 1, 1, 1); uint const currentMap = G_MapNumberFor(wbs->currentMap); for(uint i = 0; i < currentMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][currentMap]); } } DGL_Disable(DGL_TEXTURE_2D); }
static void drawLocationMarks(void) { if((gameModeBits & GM_ANY_DOOM) && wbs->episode < 3) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); // Draw a splat on taken cities. { int i, last = (wbs->currentMap == 8) ? wbs->nextMap-1 : wbs->currentMap; for(i = 0; i <= last; ++i) { drawPatchIfFits(pSplat, &locations[wbs->episode][i]); }} // Splat the secret map? if(wbs->didSecret) { drawPatchIfFits(pSplat, &locations[wbs->episode][8]); } if(drawYouAreHere) { const Point2Raw* origin = &locations[wbs->episode][wbs->nextMap]; patchid_t patchId = chooseYouAreHerePatch(origin); if(0 != patchId) { WI_DrawPatch3(patchId, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } DGL_Disable(DGL_TEXTURE_2D); } }
static void drawBackground(void) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); GL_DrawPatchXY3(pBackground, 0, 0, ALIGN_TOPLEFT, DPF_NO_OFFSET); if(!(gameModeBits & GM_ANY_DOOM2) && wbs->episode < 3) { patchid_t patchId; int i; FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); for(i = 0; i < animCounts[wbs->episode]; ++i) { wianimdef_t const *def = &animDefs[wbs->episode][i]; wianimstate_t *state = &animStates[i]; // Has the animation begun yet? if(state->frame < 0) continue; patchId = state->patches[state->frame]; WI_DrawPatch3(patchId, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId), &def->origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } DGL_Disable(DGL_TEXTURE_2D); }
static void drawEnteringTitle(void) { int x = SCREENWIDTH/2, y = WI_TITLEY; char* mapName = NULL; uint mapNum; ddmapinfo_t minfo; patchid_t patchId; patchinfo_t info; AutoStr* mapPath; Uri* mapUri; /// @kludge We need to properly externalize the map progression. if((gameModeBits & (GM_DOOM2|GM_DOOM2_PLUT|GM_DOOM2_TNT)) && wbs->nextMap == 30) { return; } /// kludge end. // See if there is a map name. mapUri = G_ComposeMapUri(wbs->episode, wbs->nextMap); mapPath = Uri_Compose(mapUri); if(Def_Get(DD_DEF_MAP_INFO, Str_Text(mapPath), &minfo) && minfo.name) { if(Def_Get(DD_DEF_TEXT, minfo.name, &mapName) == -1) mapName = minfo.name; } Uri_Delete(mapUri); // Skip the E#M# or Map #. if(mapName) { char* ptr = strchr(mapName, ':'); if(ptr) { mapName = M_SkipWhite(ptr + 1); } } DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); // Draw "Entering" WI_DrawPatchXY3(pEntering, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pEntering), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); if(R_GetPatchInfo(pMapNames[wbs->nextMap], &info)) y += (5 * info.geometry.size.height) / 4; // Draw map. mapNum = (wbs->episode * 9) + wbs->nextMap; patchId = (mapNum < pMapNamesSize? pMapNames[mapNum] : 0); FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); WI_DrawPatchXY3(patchId, Hu_ChoosePatchReplacement2(cfg.inludePatchReplaceMode, patchId, mapName), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); }
//This compares the atomtypes looking for wildcards. bool AtomType::CompareType(AtomType* InType) { if (InType->FID().compare(FID()) == 0) { return true; } //Checking for special W wildcard if (InType->FID().compare("W") == 0) { if (FID().compare("H") != 0) { return true; } else { return false; } } //Checking for wildcards if (FNumAtomAlternatives() == 0 && InType->FNumAtomAlternatives() == 0) { return false; } //Dealing with wildcards if they exist if (FNumAtomAlternatives() == 0) { for (int i=0; i < InType->FNumAtomAlternatives(); i++) { if (FID().compare(InType->GetAlternative(i)) == 0) { return true; } } return false; } if (InType->FNumAtomAlternatives() == 0) { for (int i=0; i < FNumAtomAlternatives(); i++) { if (GetAlternative(i).compare(InType->FID()) == 0) { return true; } } return false; } for (int i=0; i < InType->FNumAtomAlternatives(); i++) { for (int j=0; j < FNumAtomAlternatives(); j++) { if (GetAlternative(j).compare(InType->GetAlternative(i)) == 0) { return true; } } } return false; };
BOOL Timer::LoadToken(int id, BiffReader *pbr) { if (id == FID(PIID)) { pbr->GetInt((int *)pbr->m_pdata); } else if (id == FID(VCEN)) { pbr->GetStruct(&m_d.m_v, sizeof(Vertex2D)); } else if (id == FID(TMON)) { pbr->GetBool(&m_d.m_tdr.m_fTimerEnabled); } else if (id == FID(TMIN)) { pbr->GetInt(&m_d.m_tdr.m_TimerInterval); } else if (id == FID(NAME)) { pbr->GetWideString((WCHAR *)m_wzName); } else if (id == FID(BGLS)) { pbr->GetBool(&m_fBackglass); } else { ISelect::LoadToken(id, pbr); } return fTrue; }
BOOL DragPoint::LoadToken(int id, BiffReader *pbr) { if (id == FID(VCEN)) { pbr->GetStruct(&m_v, sizeof(Vertex2D)); } else if (id == FID(POSZ)) { pbr->GetFloat(&m_v.z); } else if (id == FID(SMTH)) { pbr->GetBool(&m_fSmooth); } else if (id == FID(SLNG)) { pbr->GetBool(&m_fSlingshot); } else if (id == FID(ATEX)) { pbr->GetBool(&m_fAutoTexture); } else if (id == FID(TEXC)) { pbr->GetFloat(&m_texturecoord); } else { ISelect::LoadToken(id, pbr); } return fTrue; }
void IN_DrawDMStats(void) { #define TRACKING (1) static int sounds; int i, j, ypos = 55, xpos = 90, kpos; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("TOTAL", 265, 30, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("VICTIMS", 140, 8, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); for(i = 0; i < 7; ++i) { FR_DrawTextXY3(killersText[i], 10, 80 + 9 * i, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); } DGL_Disable(DGL_TEXTURE_2D); if(interTime < 20) { DGL_Enable(DGL_TEXTURE_2D); for(i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].members) { M_DrawShadowedPatch(dpFaceAlive[i], 40, ((ypos << FRACBITS) + dSlideY[i] * interTime) >> FRACBITS); M_DrawShadowedPatch(dpFaceDead[i], ((xpos << FRACBITS) + dSlideX[i] * interTime) >> FRACBITS, 18); } }
static void drawSinglePlayerStats(void) { int lh; lh = (3 * FR_CharHeight('0')) / 2; // Line height. DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); WI_DrawPatchXY3(pKills, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pKills), SP_STATSX, SP_STATSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pItems, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pItems), SP_STATSX, SP_STATSY + lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pSecretSP, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pSecretSP), SP_STATSX, SP_STATSY + 2 * lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pTime, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pTime), SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); if(wbs->parTime != -1) { WI_DrawPatchXY3(pPar, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pPar), SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } FR_SetFont(FID(GF_SMALL)); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cntKills[0]); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + lh, cntItems[0]); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + 2 * lh, cntSecret[0]); if(cntTime >= 0) { drawTime(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY, cntTime / TICRATE); } if(wbs->parTime != -1 && cntPar >= 0) { drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cntPar / TICRATE); } DGL_Disable(DGL_TEXTURE_2D); }
void throttleCPU(void *t) { uint64_t msr; PState p; uint32_t newfreq, oldfreq; bcopy(t,&p,sizeof(PState)); // get the ctl we want msr = rdmsr64(INTEL_MSR_PERF_STS); // read current MSR // For clock recalibration oldfreq = FID_to_Hz(FID(msr)); // blank out last 32 bits and put our ctl there msr = (msr & 0xffffffffffff0000ULL) | CTL(p.Frequency, p.Voltage); newfreq = FID_to_Hz(FID(msr)); // after setting ctl in msr //if (RtcFixKernel && !ConstantTSC) { //rtc_clock_stepping(newfreq, oldfreq); //} wrmsr64(INTEL_MSR_PERF_CTL, msr); // and write it to the processor //if (RtcFixKernel && !ConstantTSC) //rtc_clock_stepped(newfreq, oldfreq); }
void IHaveDragPoints::LoadPointToken(int id, BiffReader *pbr, int version) { if (id == FID(DPNT)) { CComObject<DragPoint> *pdp; CComObject<DragPoint>::CreateInstance(&pdp); if (pdp) { pdp->AddRef(); pdp->Init(this, 0, 0); m_vdpoint.AddElement(pdp); BiffReader br(pbr->m_pistream, pdp, NULL, version, pbr->m_hcrypthash, pbr->m_hcryptkey); br.Load(); } } }
static void drawFinishedTitle(void) { int x = SCREENWIDTH/2, y = WI_TITLEY; patchid_t patchId; patchinfo_t info; char *mapName; uint mapNum; if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) mapNum = wbs->currentMap; else mapNum = (wbs->episode * 9) + wbs->currentMap; mapName = (char *) DD_GetVariable(DD_MAP_NAME); // Skip the E#M# or Map #. if(mapName) { char* ptr = strchr(mapName, ':'); if(ptr) { mapName = M_SkipWhite(ptr + 1); } } DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); // Draw <MapName> patchId = (mapNum < pMapNamesSize? pMapNames[mapNum] : 0); WI_DrawPatchXY3(patchId, Hu_ChoosePatchReplacement2(cfg.inludePatchReplaceMode, patchId, mapName), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); if(R_GetPatchInfo(patchId, &info)) y += (5 * info.geometry.size.height) / 4; // Draw "Finished!" FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); WI_DrawPatchXY3(pFinished, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFinished), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); }
std::string GameCritterObject::_generateArmorFrmString() { if (!armorSlot()) { return ResourceManager::FIDtoFrmName(FID()).substr(13,6); } switch(gender()) { case GENDER_FEMALE: { return ResourceManager::FIDtoFrmName(armorSlot()->femaleFID()).substr(13, 6); } default: // MALE { return ResourceManager::FIDtoFrmName(armorSlot()->maleFID()).substr(13, 6); } } }
HRESULT IHaveDragPoints::SavePointData(IStream *pstm, HCRYPTHASH hcrypthash, HCRYPTKEY hcryptkey) { BiffWriter bw(pstm, hcrypthash, hcryptkey); for (int i = 0; i < m_vdpoint.Size(); i++) { bw.WriteTag(FID(DPNT)); CComObject<DragPoint> *pdp = m_vdpoint.ElementAt(i); bw.WriteStruct(FID(VCEN), &(pdp->m_v), sizeof(Vertex2D)); bw.WriteFloat(FID(POSZ), pdp->m_v.z); bw.WriteBool(FID(SMTH), pdp->m_fSmooth); bw.WriteBool(FID(SLNG), pdp->m_fSlingshot); bw.WriteBool(FID(ATEX), pdp->m_fAutoTexture); bw.WriteFloat(FID(TEXC), pdp->m_texturecoord); ((ISelect *)pdp)->SaveData(pstm, hcrypthash, hcryptkey); bw.WriteTag(FID(ENDB)); } return S_OK; }
HRESULT Timer::SaveData(IStream *pstm, HCRYPTHASH hcrypthash, HCRYPTKEY hcryptkey) { BiffWriter bw(pstm, hcrypthash, hcryptkey); bw.WriteStruct(FID(VCEN), &m_d.m_v, sizeof(Vertex2D)); bw.WriteBool(FID(TMON), m_d.m_tdr.m_fTimerEnabled); bw.WriteInt(FID(TMIN), m_d.m_tdr.m_TimerInterval); bw.WriteWideString(FID(NAME), (WCHAR *)m_wzName); bw.WriteBool(FID(BGLS), m_fBackglass); ISelect::SaveData(pstm, hcrypthash, hcryptkey); bw.WriteTag(FID(ENDB)); return S_OK; }
HRESULT BiffReader::Load() { int tag = 0; while (tag != FID(ENDB)) { if (m_version > 30) { GetIntNoHash(&m_bytesinrecordremaining); } const HRESULT hr = GetInt(&tag); BOOL fContinue = fFalse; if (hr == S_OK) { fContinue = m_piloadable->LoadToken(tag, this); } if (!fContinue) { return E_FAIL; } if (m_version > 30) { if (m_bytesinrecordremaining > 0) { BYTE * const szT = new BYTE[m_bytesinrecordremaining]; GetStruct(szT, m_bytesinrecordremaining); delete [] szT; } } } return S_OK; }
HRESULT PinBinary::SaveToStream(IStream *pstream) { //HRESULT hr; BiffWriter bw(pstream, NULL, NULL); bw.WriteString(FID(NAME), m_szName); bw.WriteString(FID(INME), m_szInternalName); bw.WriteString(FID(PATH), m_szPath); bw.WriteInt(FID(SIZE), m_cdata); bw.WriteStruct(FID(DATA), m_pdata, m_cdata); bw.WriteTag(FID(ENDB)); return S_OK; }
BOOL Flasher::LoadToken(int id, BiffReader *pbr) { if (id == FID(PIID)) { pbr->GetInt((int *)pbr->m_pdata); } else if (id == FID(FHEI)) { pbr->GetFloat(&m_d.m_height); } else if (id == FID(FLAX)) { pbr->GetFloat(&m_d.m_vCenter.x); } else if (id == FID(FLAY)) { pbr->GetFloat(&m_d.m_vCenter.y); } else if (id == FID(FROX)) { pbr->GetFloat(&m_d.m_rotX); } else if (id == FID(FROY)) { pbr->GetFloat(&m_d.m_rotY); } else if (id == FID(FROZ)) { pbr->GetFloat(&m_d.m_rotZ); } else if (id == FID(COLR)) { pbr->GetInt(&m_d.m_color); } else if (id == FID(TMON)) { pbr->GetBool(&m_d.m_tdr.m_fTimerEnabled); } else if (id == FID(TMIN)) { pbr->GetInt(&m_d.m_tdr.m_TimerInterval); } else if (id == FID(IMAG)) { pbr->GetString(m_d.m_szImageA); } else if (id == FID(IMAB)) { pbr->GetString(m_d.m_szImageB); } else if (id == FID(FALP)) { int iTmp; pbr->GetInt(&iTmp); //if( iTmp>100 ) iTmp=100; if (iTmp < 0) iTmp = 0; m_d.m_fAlpha = iTmp; } else if (id == FID(MOVA)) { pbr->GetFloat(&m_d.m_modulate_vs_add); } else if (id == FID(NAME)) { pbr->GetWideString((WCHAR *)m_wzName); } else if (id == FID(FVIS)) { BOOL iTmp; pbr->GetBool(&iTmp); m_d.m_IsVisible = (iTmp == 1); } else if (id == FID(ADDB)) { BOOL iTmp; pbr->GetBool(&iTmp); m_d.m_fAddBlend = (iTmp == 1); } else if (id == FID(IDMD)) { BOOL iTmp; pbr->GetBool(&iTmp); m_d.m_IsDMD = (iTmp == 1); } else if (id == FID(DSPT)) { pbr->GetBool(&m_d.m_fDisplayTexture); } else if (id == FID(FLDB)) { pbr->GetFloat(&m_d.m_depthBias); } else if (id == FID(ALGN)) { pbr->GetInt(&m_d.m_imagealignment); } else if (id == FID(FILT)) { pbr->GetInt(&m_d.m_filter); } else if (id == FID(FIAM)) { pbr->GetInt(&m_d.m_fFilterAmount); } else { LoadPointToken(id, pbr, pbr->m_version); ISelect::LoadToken(id, pbr); } return fTrue; }
HRESULT Flasher::SaveData(IStream *pstm, HCRYPTHASH hcrypthash, HCRYPTKEY hcryptkey) { BiffWriter bw(pstm, hcrypthash, hcryptkey); bw.WriteFloat(FID(FHEI), m_d.m_height); bw.WriteFloat(FID(FLAX), m_d.m_vCenter.x); bw.WriteFloat(FID(FLAY), m_d.m_vCenter.y); bw.WriteFloat(FID(FROX), m_d.m_rotX); bw.WriteFloat(FID(FROY), m_d.m_rotY); bw.WriteFloat(FID(FROZ), m_d.m_rotZ); bw.WriteInt(FID(COLR), m_d.m_color); bw.WriteBool(FID(TMON), m_d.m_tdr.m_fTimerEnabled); bw.WriteInt(FID(TMIN), m_d.m_tdr.m_TimerInterval); bw.WriteWideString(FID(NAME), (WCHAR *)m_wzName); bw.WriteString(FID(IMAG), m_d.m_szImageA); bw.WriteString(FID(IMAB), m_d.m_szImageB); bw.WriteInt(FID(FALP), m_d.m_fAlpha); bw.WriteFloat(FID(MOVA), m_d.m_modulate_vs_add); bw.WriteBool(FID(FVIS), m_d.m_IsVisible); bw.WriteBool(FID(DSPT), m_d.m_fDisplayTexture); bw.WriteBool(FID(ADDB), m_d.m_fAddBlend); bw.WriteBool(FID(IDMD), m_d.m_IsDMD); bw.WriteFloat(FID(FLDB), m_d.m_depthBias); bw.WriteInt(FID(ALGN), m_d.m_imagealignment); bw.WriteInt(FID(FILT), m_d.m_filter); bw.WriteInt(FID(FIAM), m_d.m_fFilterAmount); ISelect::SaveData(pstm, hcrypthash, hcryptkey); HRESULT hr; if (FAILED(hr = SavePointData(pstm, hcrypthash, hcryptkey))) return hr; bw.WriteTag(FID(ENDB)); return S_OK; }
void IN_DrawSingleStats(void) { #define TRACKING (1) static int sounds; char buf[20]; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("KILLS", 50, 65, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("ITEMS", 50, 90, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("SECRETS", 50, 115, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 30) { sounds = 0; return; } if(sounds < 1 && interTime >= 30) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].killCount); FR_SetFont(FID(GF_FONTB)); FR_SetTracking(TRACKING); M_DrawTextFragmentShadowed(buf, 236, 65, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 65, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalKills); M_DrawTextFragmentShadowed(buf, 284, 65, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 60) return; if(sounds < 2 && interTime >= 60) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].itemCount); FR_SetFont(FID(GF_FONTB)); M_DrawTextFragmentShadowed(buf, 236, 90, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 90, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalItems); M_DrawTextFragmentShadowed(buf, 284, 90, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 90) return; if(sounds < 3 && interTime >= 90) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].secretCount); FR_SetFont(FID(GF_FONTB)); M_DrawTextFragmentShadowed(buf, 236, 115, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 115, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalSecret); M_DrawTextFragmentShadowed(buf, 284, 115, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 150) { return; } if(sounds < 4 && interTime >= 150) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } if(gameMode != heretic_extended || wbs->episode < 3) { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("TIME", 85, 160, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); IN_DrawTime(284, 160, hours, minutes, seconds, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); } else { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTA)); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", SCREENWIDTH/2, 160, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->nextMap), 160, 170, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Disable(DGL_TEXTURE_2D); skipIntermission = false; } #undef TRACKING }
bool createPStateTable(PState* pS, unsigned int* numStates) { checkForPenryn(); // early on, so we can display proper mV values /* If the PState table was specified manually, we dont do the rest. Otherwise autodetect */ if (NumberOfPStates != 0) { dbg("PState table was already created. No autodetection will be performed\n"); return true; } /* Find CPUs in the IODeviceTree plane */ IORegistryEntry* ioreg = IORegistryEntry::fromPath("/cpus", IORegistryEntry::getPlane("IODeviceTree")); if (ioreg == 0) { warn("Holy moly we cannot find your CPU!\n"); return false; } /* Get the first CPU - we assume all CPUs share the same P-State */ IOACPIPlatformDevice* cpu = (IOACPIPlatformDevice*) ioreg->getChildEntry(IORegistryEntry::getPlane("IODeviceTree")); if (cpu == 0) { warn("Um you don't seem to have a CPU o.O\n"); ioreg = 0; return false; } dbg("Using data from %s\n", cpu->getName()); /* Now try to find the performance state table */ OSObject* PSS; cpu->evaluateObject("_PSS", &PSS); if(PSS == 0 ) { warn("Auto-creating a PState table.\n"); int maxFID = MHz_to_FID(getCurrentFrequency()); int maxVID = mV_to_VID(getCurrentVoltage()); int minVID = mV_to_VID(800); // For now we'll use hardcoded minvolt, later use table int minFID = 6; // No LFM right now NumberOfPStates = 1 + ((maxFID - minFID) / 2); for (int i = 1; i < NumberOfPStates; i++) { PStates[i].Frequency = minFID + (2*(NumberOfPStates - i - 1)); PStates[i].AcpiFreq = FID_to_MHz(PStates[i].Frequency); PStates[i].OriginalVoltage = maxVID - (i*((maxVID - minVID) / NumberOfPStates)) ; PStates[i].Voltage = PStates[i].OriginalVoltage; PStates[i].Latency = 110; PStates[i].TimesChosen = 0; } PStates[0].Frequency = maxFID; PStates[0].AcpiFreq = FID_to_MHz(maxFID); PStates[0].OriginalVoltage = maxVID; PStates[0].Voltage = PStates[0].OriginalVoltage; PStates[0].Latency = 110; PStates[0].TimesChosen = 0; MaxLatency = PStates[0].Latency; info("Using %d PStates (auto-created, may not be optimal).\n", NumberOfPStates); ioreg = 0; cpu = 0; return true; } OSArray* PSSArray = (OSArray*) PSS; NumberOfPStates = PSSArray->getCount(); info("Found %d P-States\n", NumberOfPStates); OSArray* onestate; uint16_t ctl, acpifreq; uint32_t power, latency; int i = 0, c = 0; while (c < PSSArray->getCount()) { onestate = ( OSArray* )(PSSArray->getObject(c)); ctl = ((OSNumber*) onestate->getObject(4))->unsigned32BitValue(); acpifreq = ((OSNumber*) onestate->getObject(0))->unsigned32BitValue(); power = ((OSNumber*) onestate->getObject(1))->unsigned32BitValue(); latency = ((OSNumber*) onestate->getObject(2))->unsigned32BitValue(); c++; info("clt: 0x%x , vid: %d , fid: %d \n", ctl , VID(ctl), FID(ctl) ); if (acpifreq - (10 * (acpifreq / 10)) == 1) { // most likely spurious, so skip it warn("** Spurious P-State %d: %d MHz at %d mV, consuming %d W, latency %d usec\n", i, acpifreq, VID_to_mV(ctl), power / 1000, latency); NumberOfPStates--; continue; } if (acpifreq < 1000 && !Below1Ghz) { warn("%d MHz disabled because your processor or kernel doesn't support it.\n",acpifreq); NumberOfPStates--; continue; } PStates[i].AcpiFreq = acpifreq; // cosmetic only PStates[i].Frequency = FID(ctl); PStates[i].OriginalVoltage = VID(ctl); PStates[i].Voltage = PStates[i].OriginalVoltage *50 / 100; // initially same PStates[i].Latency = latency; PStates[i].TimesChosen = 0; if (latency > MaxLatency) MaxLatency = latency; info("Auto: P-State %d: %d MHz at %d mV VID: %d, consuming %d W, latency %d usec\n", i, PStates[i].AcpiFreq, VID_to_mV(PStates[i].Voltage),PStates[i].Voltage, power / 1000, latency); i++; } info("Using %d PStates.\n", NumberOfPStates); ioreg = 0; cpu = 0; PSS = 0; onestate = 0; return true; }
uint16_t getCurrentFrequency() { uint64_t msr = rdmsr64(INTEL_MSR_PERF_STS); return FID_to_MHz(FID(msr)); }
void GameCritterObject::setOrientation(int value) { GameObject::setOrientation(value); unsigned int frmId = FID() & 0x00000FFF; unsigned int ID1 = (FID() & 0x0000F000) >> 12; unsigned int ID2 = (FID() & 0x00FF0000) >> 16; unsigned int ID3 = (FID() & 0xF0000000) >> 28; auto lst = ResourceManager::lstFileType("art/critters/critters.lst"); std::string frmName = lst->strings()->at(frmId); std::string frmBase = frmName.substr(0, 6); if (ID2 >= 0x26 && ID2 <= 0x2F) { if (ID1 >= 0x0B || ID1 == 0) throw Exception("Critter ID1 unsupported value"); frmBase += ID1 + 0x63; frmBase += ID2 + 0x3D; } else if (ID2 == 0x24) { frmBase += "ch"; } else if (ID2 == 0x25) { frmBase += "cj"; } else if (ID2 == 0x40) { frmBase += "na"; } else if (ID2 >= 0x30) { frmBase += "r"; frmBase += ID2 + 0x31; } else if (ID2 >= 0x14) { frmBase += "b"; frmBase += ID2 + 0x4d; } else if (ID2 == 0x12) { if (ID1 == 0x01) { frmBase += "dm"; } else if (ID1 == 0x04) { frmBase += "gm"; } else { frmBase += "as"; } } else if (ID2 == 0x0D) { if (ID1 > 0) { frmBase += ID1 + 0x63; frmBase += "e"; } else { frmBase += "an"; } } else if (ID2 <= 0x01 && ID1 > 0) { frmBase += ID1 + 0x63; frmBase += ID2 + 0x61; } else { frmBase += "a"; frmBase += ID2 + 0x61; } std::string extensions[] = {"frm", "frm0", "frm1", "frm2", "fr3", "frm4", "frm5", "frm6"}; frmBase += "." + extensions[ID3]; auto frm = ResourceManager::frmFileType("art/critters/" + frmBase); animationQueue()->clear(); auto animation = new Animation(frm); if (ID3 == 0) { animation->setCurrentSurfaceSet(this->orientation()); } animationQueue()->add(animation); }
void IN_DrawCoopStats(void) { #define TRACKING (1) static int sounds; int i, ypos; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("KILLS", 95, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("BONUS", 155, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("SECRET", 232, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), SCREENWIDTH/2, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("FINISHED", SCREENWIDTH/2, 25, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetTracking(TRACKING); ypos = 50; for(i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].members) { char buf[20]; DGL_Color4f(0, 0, 0, .4f); GL_DrawPatchXY(dpFaceAlive[i], 27, ypos+2); DGL_Color4f(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); GL_DrawPatchXY(dpFaceAlive[i], 25, ypos); if(interTime < 40) { sounds = 0; ypos += 37; continue; } else if(interTime >= 40 && sounds < 1) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } dd_snprintf(buf, 20, "%i", killPercent[i]); M_DrawTextFragmentShadowed(buf, 121, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 121, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", bonusPercent[i]); M_DrawTextFragmentShadowed(buf, 196, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 196, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", secretPercent[i]); M_DrawTextFragmentShadowed(buf, 273, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 273, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); ypos += 37; } } DGL_Disable(DGL_TEXTURE_2D); #undef TRACKING }