MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawExamines

Method DrawExamines

TombEngine/Renderer/RendererDrawMenu.cpp:1197–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195 }
1196
1197 void Renderer::DrawExamines()
1198 {
1199 auto screenPos = Vector2(DISPLAY_SPACE_RES.x / 2, DISPLAY_SPACE_RES.y / 2);
1200
1201 static EulerAngles orient = EulerAngles::Identity;
1202 static float scaler = 1.2f;
1203 float multiplier = g_Renderer.GetFramerateMultiplier();
1204
1205 short invItem = g_Gui.GetRing(RingTypes::Inventory).CurrentObjectList[g_Gui.GetRing(RingTypes::Inventory).CurrentObjectInList].InventoryItem;
1206
1207 auto& object = InventoryObjectTable[invItem];
1208
1209 if (IsHeld(In::Forward))
1210 orient.x += ANGLE(3.0f / multiplier);
1211
1212 if (IsHeld(In::Back))
1213 orient.x -= ANGLE(3.0f / multiplier);
1214
1215 if (IsHeld(In::Left))
1216 orient.y += ANGLE(3.0f / multiplier);
1217
1218 if (IsHeld(In::Right))
1219 orient.y -= ANGLE(3.0f / multiplier);
1220
1221 if (IsHeld(In::Sprint))
1222 scaler += 0.03f / multiplier;
1223
1224 if (IsHeld(In::Crouch))
1225 scaler -= 0.03f / multiplier;
1226
1227 if (scaler > 1.6f)
1228 scaler = 1.6f;
1229
1230 if (scaler < 0.8f)
1231 scaler = 0.8f;
1232
1233 // Construct string key and try to get it.
1234 auto stringKey = TEN::Utils::ToLower(GetObjectName((GAME_OBJECT_ID)object.ObjectNumber)) + "_text";
1235 auto string = g_GameFlow->GetString(stringKey.c_str());
1236
1237 // If string is found, draw it and shift examine position upwards.
1238 if (GetHash(string) != GetHash(stringKey))
1239 {
1240 AddString(screenPos.x, screenPos.y + screenPos.y / 2.0f, g_GameFlow->GetString(stringKey.c_str()),
1241 g_GameFlow->GetSettings()->UI.PlainTextColor, SF_Center() | (int)PrintStringFlags::VerticalCenter);
1242
1243 screenPos.y -= screenPos.y / 4.0f;
1244 }
1245
1246 float savedScale = object.Scale1;
1247 object.Scale1 = scaler;
1248 DrawObjectIn2DSpace(g_Gui.ConvertInventoryItemToObject(invItem), screenPos, orient, object.Scale1);
1249 object.Scale1 = savedScale;
1250
1251 DrawAllStrings();
1252 }
1253
1254 void Renderer::RenderInventoryScene(RenderTarget2D* renderTarget, TextureBase* background, float backgroundFade)

Callers

nothing calls this directly

Calls 11

IsHeldFunction · 0.85
ANGLEFunction · 0.85
ToLowerFunction · 0.85
GetHashFunction · 0.85
SF_CenterFunction · 0.85
GetStringMethod · 0.80
GetSettingsMethod · 0.80
Vector2Function · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected