void SV_LoadGameClient(uint /*sessionId*/) { throw de::Error("SV_LoadGameClient", "Not currently implemented"); #if 0 #if !__JHEXEN__ // unsupported in libhexen player_t *cpl = players + CONSOLEPLAYER; mobj_t *mo = cpl->plr->mo; if(!IS_CLIENT || !mo) return; de::game::GameStateFolder *session = new de::game::GameStateFolder(saveNameForClientSessionId(sessionId)); de::game::GameStateMetadata *metadata = new de::game::GameStateMetadata; //G_ReadLegacySessionMetadata(metadata, reader); metadata->set("sessionId", sessionId); session->replaceMetadata(metadata); de::Path path = de::String("/savegame") / "client" / session->path(); if(!SV_OpenFileForRead(path)) { delete session; App_Log(DE2_RES_WARNING, "SV_LoadGameClient: Failed opening \"%s\" for reading", path.toString().toLatin1().constData()); return; } if((*metadata)["magic"].value().asNumber() != MY_CLIENT_SAVE_MAGIC) { SV_CloseFile(); delete session; App_Log(DE2_RES_ERROR, "Client save file format not recognized"); return; } Reader1 *reader = SV_NewReader(); int const saveVersion = (*metadata)["version"].value().asNumber(); Uri *mapUri = Uri_NewWithPath2((*metadata)["mapUri"].value().asText().toUtf8().constData(), RC_NULL); GameRules *rules = 0; if(metadata->hasSubrecord("gameRules")) { rules = GameRules::fromRecord(metadata->subrecord("gameRules")); } // Do we need to change the map? if(gfw_Session()->mapUri() != *reinterpret_cast<de::Uri *>(mapUri)) { gfw_Session()->begin(*mapUri, 0/*default*/, *rules); } else if(rules) { gfw_Session()->rules() = *rules; } delete rules; rules = 0; Uri_Delete(mapUri); mapUri = 0; mapTime = (*metadata)["mapTime"].value().asNumber(); P_MobjUnlink(mo); mo->origin[VX] = FIX2FLT(Reader_ReadInt32(reader)); mo->origin[VY] = FIX2FLT(Reader_ReadInt32(reader)); mo->origin[VZ] = FIX2FLT(Reader_ReadInt32(reader)); P_MobjLink(mo); mo->floorZ = FIX2FLT(Reader_ReadInt32(reader)); mo->ceilingZ = FIX2FLT(Reader_ReadInt32(reader)); mo->angle = Reader_ReadInt32(reader); /* $unifiedangles */ cpl->plr->lookDir = Reader_ReadFloat(reader); /* $unifiedangles */ #if __JHEXEN__ if(saveVersion >= 4) #else if(saveVersion >= 5) #endif { SV_AssertSegment(ASEG_PLAYER_HEADER); } playerheader_t plrHdr; plrHdr.read(reader, saveVersion); cpl->read(reader, plrHdr); MapStateReader(*session).read(Str_Text(Uri_Resolved(mapUri))); SV_CloseFile(); Reader_Delete(reader); delete session; #else DENG2_UNUSED(sessionId); #endif #endif }
static Uri *readTextureUrn(Reader *reader, char const *schemeName) { DENG_ASSERT(reader && schemeName); return Uri_NewWithPath2(Str_Text(Str_Appendf(AutoStr_NewStd(), "urn:%s:%i", schemeName, Reader_ReadInt16(svReader))), RC_NULL); }
static void parseParamaterBlock(char** strPtr, drawtextstate_t* state, int* numBreaks) { (*strPtr)++; while(*(*strPtr) && *(*strPtr) != '}') { (*strPtr) = M_SkipWhite((*strPtr)); // What do we have here? if(!strnicmp((*strPtr), "flash", 5)) { (*strPtr) += 5; state->typeIn = true; } else if(!strnicmp((*strPtr), "noflash", 7)) { (*strPtr) += 7; state->typeIn = false; } else if(!strnicmp((*strPtr), "case", 4)) { (*strPtr) += 4; state->caseScale = true; } else if(!strnicmp((*strPtr), "nocase", 6)) { (*strPtr) += 6; state->caseScale = false; } else if(!strnicmp((*strPtr), "ups", 3)) { (*strPtr) += 3; state->caseMod[1].scale = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "upo", 3)) { (*strPtr) += 3; state->caseMod[1].offset = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "los", 3)) { (*strPtr) += 3; state->caseMod[0].scale = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "loo", 3)) { (*strPtr) += 3; state->caseMod[0].offset = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "break", 5)) { (*strPtr) += 5; ++(*numBreaks); } else if(!strnicmp((*strPtr), "r", 1)) { (*strPtr)++; state->rgba[CR] = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "g", 1)) { (*strPtr)++; state->rgba[CG] = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "b", 1)) { (*strPtr)++; state->rgba[CB] = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "a", 1)) { (*strPtr)++; state->rgba[CA] = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "x", 1)) { (*strPtr)++; state->offX = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "y", 1)) { (*strPtr)++; state->offY = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "scalex", 6)) { (*strPtr) += 6; state->scaleX = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "scaley", 6)) { (*strPtr) += 6; state->scaleY = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "scale", 5)) { (*strPtr) += 5; state->scaleX = state->scaleY = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "angle", 5)) { (*strPtr) += 5; state->angle = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "glitter", 7)) { (*strPtr) += 7; state->glitterStrength = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "shadow", 6)) { (*strPtr) += 6; state->shadowStrength = parseFloat(&(*strPtr)); } else if(!strnicmp((*strPtr), "tracking", 8)) { (*strPtr) += 8; state->tracking = parseFloat(&(*strPtr)); } else { // Perhaps a font name? fontid_t fontId; if(!strnicmp((*strPtr), "font", 4)) { char buf[80]; (*strPtr) += 4; if(parseString(&(*strPtr), buf, 80)) { Uri* uri = Uri_NewWithPath2(buf, RC_NULL); fontId = Fonts_ResolveUri2(uri, true/*quiet please*/); Uri_Delete(uri); if(fontId != NOFONTID) { state->fontNum = fontId; continue; } } Con_Message("Warning:parseParamaterBlock: Unknown font '%s'.", (*strPtr)); continue; } // Unknown, skip it. if(*(*strPtr) != '}') (*strPtr)++; } } // Skip over the closing brace. if(*(*strPtr)) (*strPtr)++; }