Skip to content

Commit bd1a3c8

Browse files
Merge pull request #500 from tiltedphoques/prerel
V1.3.1
2 parents 85ec4d2 + e10f472 commit bd1a3c8

12 files changed

Lines changed: 426 additions & 52 deletions

File tree

Code/client/Games/Skyrim/Actor.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,18 @@ struct Actor : TESObjectREFR
364364
//void Save_Reversed(uint32_t aChangeFlags, Buffer::Writer& aWriter);
365365
};
366366

367-
static_assert(offsetof(Actor, currentProcess) == 0xF0);
368-
static_assert(offsetof(Actor, flags1) == 0xE0);
369-
static_assert(offsetof(Actor, actorValueOwner) == 0xB0);
370-
static_assert(offsetof(Actor, actorState) == 0xB8);
371-
static_assert(offsetof(Actor, flags2) == 0x1FC);
372-
static_assert(offsetof(Actor, unk194) == 0x270);
373-
static_assert(offsetof(Actor, fVoiceTimer) == 0x108);
374-
static_assert(offsetof(Actor, unk84) == 0xE8);
375-
static_assert(offsetof(Actor, unk17C) == 0x17C);
376-
static_assert(offsetof(Actor, pCombatController) == 0x158);
377-
static_assert(offsetof(Actor, magicItems) == 0x1C0);
378-
static_assert(offsetof(Actor, equippedShout) == 0x1E0);
379-
static_assert(offsetof(Actor, actorLock) == 0x27C);
380-
static_assert(sizeof(Actor) == 0x2B0);
367+
static_assert(offsetof(Actor, currentProcess) == 0xF8);
368+
static_assert(offsetof(Actor, flags1) == 0xE8);
369+
static_assert(offsetof(Actor, actorValueOwner) == 0xB8);
370+
static_assert(offsetof(Actor, actorState) == 0xC0);
371+
static_assert(offsetof(Actor, flags2) == 0x204);
372+
static_assert(offsetof(Actor, unk194) == 0x278);
373+
static_assert(offsetof(Actor, fVoiceTimer) == 0x110);
374+
static_assert(offsetof(Actor, unk84) == 0xF0);
375+
static_assert(offsetof(Actor, unk17C) == 0x184);
376+
static_assert(offsetof(Actor, pCombatController) == 0x160);
377+
static_assert(offsetof(Actor, magicItems) == 0x1C8);
378+
static_assert(offsetof(Actor, equippedShout) == 0x1E8);
379+
static_assert(offsetof(Actor, actorLock) == 0x284);
380+
static_assert(sizeof(Actor) == 0x2B8);
381381
static_assert(sizeof(Actor::SpellItemEntry) == 0x18);

Code/client/Games/Skyrim/ExtraData/ExtraDataList.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ struct ExtraDataList
3131

3232
[[nodiscard]] bool HasQuestObjectAlias() noexcept;
3333

34+
#if TP_SKYRIM64
35+
virtual ~ExtraDataList();
36+
#endif
37+
3438
#if TP_FALLOUT4
3539
void* unk0;
3640
#endif

Code/client/Games/Skyrim/PlayerCharacter.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct PlayerCharacter : Actor
171171
uint64_t instanceCount;
172172
};
173173

174-
uint8_t pad1[0x580 - sizeof(Actor)];
174+
uint8_t pad1[0x588 - sizeof(Actor)];
175175
GameArray<ObjectiveInstance> objectives;
176176
uint8_t pad588[0x9B0 - 0x598];
177177
Skills** pSkills;
@@ -186,10 +186,10 @@ struct PlayerCharacter : Actor
186186
uint8_t padPlayerEnd[0xBE0 - 0xB30];
187187
};
188188

189-
static_assert(offsetof(PlayerCharacter, objectives) == 0x580);
190-
static_assert(offsetof(PlayerCharacter, pSkills) == 0x9B0);
191-
static_assert(offsetof(PlayerCharacter, locationForm) == 0xAC8);
192-
static_assert(offsetof(PlayerCharacter, baseTints) == 0xB10);
193-
static_assert(offsetof(PlayerCharacter, overlayTints) == 0xB28);
194-
static_assert(sizeof(PlayerCharacter) == 0xBE0);
189+
static_assert(offsetof(PlayerCharacter, objectives) == 0x588);
190+
static_assert(offsetof(PlayerCharacter, pSkills) == 0x9B8);
191+
static_assert(offsetof(PlayerCharacter, locationForm) == 0xAD0);
192+
static_assert(offsetof(PlayerCharacter, baseTints) == 0xB18);
193+
static_assert(offsetof(PlayerCharacter, overlayTints) == 0xB30);
194+
static_assert(sizeof(PlayerCharacter) == 0xBE8);
195195

Code/client/Games/Skyrim/TESObjectREFR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,5 @@ struct TESObjectREFR : TESForm
212212
uint16_t referenceFlags;
213213
};
214214

215-
static_assert(sizeof(TESObjectREFR) == 0x98);
215+
static_assert(sizeof(TESObjectREFR) == 0xA0);
216216
static_assert(offsetof(TESObjectREFR, loadedState) == 0x68);

Code/client/Services/Generic/InputService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void ProcessKeyboard(uint16_t aKey, uint16_t aScanCode, cef_key_event_type_t aTy
235235

236236
spdlog::debug("ProcessKey, type: {}, key: {}, active: {}", aType, aKey, active);
237237

238-
if (IsToggleKey(aKey) || (IsDisableKey(aKey) && active))
238+
if (aType != KEYEVENT_CHAR && (IsToggleKey(aKey) || (IsDisableKey(aKey) && active)))
239239
{
240240
if (!overlay.GetInGame())
241241
{

Code/client/Services/Generic/PlayerService.cpp

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <Games/Overrides.h>
2929
#include <Games/References.h>
3030
#include <AI/AIProcess.h>
31+
#include <EquipManager.h>
3132

3233
PlayerService::PlayerService(World& aWorld, entt::dispatcher& aDispatcher, TransportService& aTransport) noexcept
3334
: m_world(aWorld), m_dispatcher(aDispatcher), m_transport(aTransport)
@@ -45,17 +46,6 @@ PlayerService::PlayerService(World& aWorld, entt::dispatcher& aDispatcher, Trans
4546
m_partyLeftConnection = aDispatcher.sink<PartyLeftEvent>().connect<&PlayerService::OnPartyLeftEvent>(this);
4647
}
4748

48-
namespace
49-
{
50-
bool isDeathSystemEnabled = true;
51-
52-
bool knockdownStart = false;
53-
double knockdownTimer = 0.0;
54-
55-
bool godmodeStart = false;
56-
double godmodeTimer = 0.0;
57-
}
58-
5949
void PlayerService::OnUpdate(const UpdateEvent& acEvent) noexcept
6050
{
6151
RunRespawnUpdates(acEvent.Delta);
@@ -227,14 +217,20 @@ void PlayerService::OnPartyLeftEvent(const PartyLeftEvent& acEvent) noexcept
227217
// TODO: ft (verify)
228218
void PlayerService::RunRespawnUpdates(const double acDeltaTime) noexcept
229219
{
230-
if (!isDeathSystemEnabled)
220+
if (!m_isDeathSystemEnabled)
231221
return;
232222

233223
static bool s_startTimer = false;
234224

235225
PlayerCharacter* pPlayer = PlayerCharacter::Get();
236226
if (!pPlayer->actorState.IsBleedingOut())
237227
{
228+
#if TP_SKYRIM64
229+
m_cachedMainSpellId = pPlayer->magicItems[0] ? pPlayer->magicItems[0]->formID : 0;
230+
m_cachedSecondarySpellId = pPlayer->magicItems[1] ? pPlayer->magicItems[1]->formID : 0;
231+
m_cachedPowerId = pPlayer->equippedShout ? pPlayer->equippedShout->formID : 0;
232+
#endif
233+
238234
s_startTimer = false;
239235
return;
240236
}
@@ -259,51 +255,64 @@ void PlayerService::RunRespawnUpdates(const double acDeltaTime) noexcept
259255
{
260256
pPlayer->RespawnPlayer();
261257

262-
knockdownTimer = 1.5;
263-
knockdownStart = true;
258+
m_knockdownTimer = 1.5;
259+
m_knockdownStart = true;
264260

265261
m_transport.Send(PlayerRespawnRequest());
266262

267263
s_startTimer = false;
264+
265+
#if TP_SKYRIM64
266+
auto* pEquipManager = EquipManager::Get();
267+
TESForm* pSpell = TESForm::GetById(m_cachedMainSpellId);
268+
if (pSpell)
269+
pEquipManager->EquipSpell(pPlayer, pSpell, 0);
270+
pSpell = TESForm::GetById(m_cachedSecondarySpellId);
271+
if (pSpell)
272+
pEquipManager->EquipSpell(pPlayer, pSpell, 1);
273+
pSpell = TESForm::GetById(m_cachedPowerId);
274+
if (pSpell)
275+
pEquipManager->EquipShout(pPlayer, pSpell);
276+
#endif
268277
}
269278
}
270279

271280
// TODO: ft (verify)
272281
// Doesn't seem to respawn quite yet
273282
void PlayerService::RunPostDeathUpdates(const double acDeltaTime) noexcept
274283
{
275-
if (!isDeathSystemEnabled)
284+
if (!m_isDeathSystemEnabled)
276285
return;
277286

278287
// If a player dies in ragdoll, it gets stuck.
279288
// This code ragdolls the player again upon respawning.
280289
// It also makes the player invincible for 5 seconds.
281-
if (knockdownStart)
290+
if (m_knockdownStart)
282291
{
283-
knockdownTimer -= acDeltaTime;
284-
if (knockdownTimer <= 0.0)
292+
m_knockdownTimer -= acDeltaTime;
293+
if (m_knockdownTimer <= 0.0)
285294
{
286295
PlayerCharacter::SetGodMode(true);
287-
godmodeStart = true;
288-
godmodeTimer = 10.0;
296+
m_godmodeStart = true;
297+
m_godmodeTimer = 10.0;
289298

290299
PlayerCharacter* pPlayer = PlayerCharacter::Get();
291300
pPlayer->currentProcess->KnockExplosion(pPlayer, &pPlayer->position, 0.f);
292301

293302
FadeOutGame(false, true, 0.5f, true, 2.f);
294303

295-
knockdownStart = false;
304+
m_knockdownStart = false;
296305
}
297306
}
298307

299-
if (godmodeStart)
308+
if (m_godmodeStart)
300309
{
301-
godmodeTimer -= acDeltaTime;
302-
if (godmodeTimer <= 0.0)
310+
m_godmodeTimer -= acDeltaTime;
311+
if (m_godmodeTimer <= 0.0)
303312
{
304313
PlayerCharacter::SetGodMode(false);
305314

306-
godmodeStart = false;
315+
m_godmodeStart = false;
307316
}
308317
}
309318
}
@@ -343,9 +352,9 @@ void PlayerService::RunLevelUpdates() const noexcept
343352
}
344353
}
345354

346-
void PlayerService::ToggleDeathSystem(bool aSet) const noexcept
355+
void PlayerService::ToggleDeathSystem(bool aSet) noexcept
347356
{
348-
isDeathSystemEnabled = aSet;
357+
m_isDeathSystemEnabled = aSet;
349358

350359
PlayerCharacter::Get()->SetPlayerRespawnMode(aSet);
351360
}

Code/client/Services/PlayerService.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct PlayerService
5353
void RunDifficultyUpdates() const noexcept;
5454
void RunLevelUpdates() const noexcept;
5555

56-
void ToggleDeathSystem(bool aSet) const noexcept;
56+
void ToggleDeathSystem(bool aSet) noexcept;
5757

5858
World& m_world;
5959
entt::dispatcher& m_dispatcher;
@@ -63,6 +63,18 @@ struct PlayerService
6363
int32_t m_serverDifficulty = 6;
6464
int32_t m_previousDifficulty = 6;
6565

66+
bool m_isDeathSystemEnabled = true;
67+
68+
bool m_knockdownStart = false;
69+
double m_knockdownTimer = 0.0;
70+
71+
bool m_godmodeStart = false;
72+
double m_godmodeTimer = 0.0;
73+
74+
uint32_t m_cachedMainSpellId = 0;
75+
uint32_t m_cachedSecondarySpellId = 0;
76+
uint32_t m_cachedPowerId = 0;
77+
6678
entt::scoped_connection m_updateConnection;
6779
entt::scoped_connection m_connectedConnection;
6880
entt::scoped_connection m_disconnectedConnection;

Code/client/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ static void ShowAddressLibraryError(const wchar_t* apGamePath)
1717
auto errorDetail = fmt::format(L"Looking for it here: {}\\Data\\SKSE\\Plugins", apGamePath);
1818

1919
Base::TaskDialog dia(g_SharedWindowIcon, L"Error", L"Failed to load Skyrim Address Library",
20-
L"Make sure to use the All in one Anniversary Edition", errorDetail.c_str());
20+
L"Make sure to use the All in one (Anniversary Edition) even if you don't have the Anniversary Edition upgrade", errorDetail.c_str());
2121
#elif TP_FALLOUT4
2222
auto errorDetail = fmt::format(L"Looking for it here: {}\\Data\\F4SE\\Plugins", apGamePath);
2323

2424
Base::TaskDialog dia(g_SharedWindowIcon, L"Error", L"Failed to load Fallout 4 Address Library", L"",
2525
errorDetail.c_str());
2626
#endif
2727

28+
dia.AppendButton(0xBEED, L"Visit troubleshooting page on wiki.tiltedphoques.com");
2829
dia.AppendButton(0xBEEF, L"Visit Address Library modpage on nexusmods.com");
2930
const int result = dia.Show();
3031
if (result == 0xBEEF)
@@ -37,6 +38,11 @@ static void ShowAddressLibraryError(const wchar_t* apGamePath)
3738
SW_SHOWNORMAL);
3839
#endif
3940
}
41+
else if (result == 0xBEED)
42+
{
43+
ShellExecuteW(nullptr, L"open", LR"(https://wiki.tiltedphoques.com/tilted-online/guides/troubleshooting/address-library-error)",
44+
nullptr, nullptr, SW_SHOWNORMAL);
45+
}
4046

4147
exit(4);
4248
}

Code/skyrim_ui/src/app/transloco-root.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export class TranslocoHttpLoader implements TranslocoLoader {
3030
{ id: 'fr', label: 'Français' },
3131
{ id: 'zh-CN', label: '中文(中国)'},
3232
{ id: 'nl', label: 'Nederlands' },
33+
{ id: 'es', label: 'Español' },
34+
{ id: 'cs', label: 'Čeština'},
3335
{ id: 'overwrite', label: 'Custom' },
3436
],
3537
defaultLang: 'en',
Binary file not shown.

0 commit comments

Comments
 (0)