-
Notifications
You must be signed in to change notification settings - Fork 1
/
Penumbra_Overture.asl
117 lines (94 loc) · 3.49 KB
/
Penumbra_Overture.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//---------------------------------------------------------------------------
// About: Load Remover & Auto Splitter
// Author: MagicALCN, Astropilot, Kotti, PsychoManiac
// Version: 1.2
// Last Release Date: 11 March 2021
// Repository: https://github.com/Astropilot/PenumbraOvertureAutoSplitter
//---------------------------------------------------------------------------
state("penumbra", "1.0")
{
// mpScene->mpGraphics->mpRenderer3D->mRenderSettings->mAmbientColor->r : float
int ambient_color : 0x24EE7C, 0x20, 0x18, 0x8;
// gpInit->mpMapHandler->msCurrentMap : String
string32 current_map : 0x240F54, 0x14C, 0xD8, 0x0;
// gpInit->mpPlayer->mbActive : boolean
byte player_active : 0x240F54, 0x154, 0x1C8;
// Do not exist on this version. Only present to detect version 1.1 of the game
string4 game_version : 0x242DE0;
// gpInit->mpMapHandler->mfGameTime : double
double game_time : 0x240F54, 0x14C, 0x20;
}
state("penumbra", "Steam 1.1")
{
// mpScene->mpGraphics->mpRenderer3D->mRenderSettings->mAmbientColor->r : float
int ambient_color : 0x2AC46C, 0x20, 0x18, 0xB0;
// gpInit->mpMapHandler->msCurrentMap : String
string32 current_map : 0x29DE94, 0x184, 0xD8, 0x0;
// gpInit->mpPlayer->mbActive : boolean
byte player_active : 0x29DE94, 0x18C, 0x1E4;
// Text ressources -> Game revision : String
string4 game_version : 0x242DE0;
// gpInit->mpMapHandler->mfGameTime : double
double game_time : 0x29DE94, 0x184, 0x20;
}
init
{
/*
Special note: The time given by the variable game_time is not directly usable because it is only an
incrementing variable for the current map. Its value changes when you change the map (load a save for example)
and is therefore not representative of the game time since the beginning of a game. So we only use it to
increase an internal timer because it pauses during menu returns and loading times.
*/
vars.ingame_time = TimeSpan.FromSeconds(0.0);
if (current.game_version == "3013") {
version = "Steam 1.1";
} else {
version = "1.0";
}
}
start
{
if(old.current_map != current.current_map && current.current_map == "level00_01_boat_cabin") {
vars.ingame_time = TimeSpan.FromSeconds(0.0);
return true;
}
return false;
}
reset
{
return (old.current_map != current.current_map && current.current_map == "level00_01_boat_cabin");
}
split
{
if(current.current_map != "" && old.current_map != "" && current.current_map != old.current_map) {
return true;
}
if(current.current_map == "level01_20_base_entrance" && old.player_active == 1 && current.player_active == 0) {
return true;
}
return false;
}
update
{
/*
ambient_color is used to detect the end of loading a map and avoid jumps in game_time
values during loading that would otherwise be added to the internal timer.
The ambient color is set to 0 during loading, otherwise it is in the range ]0; 1].
*/
if (current.ambient_color > 0) {
var incremental_time = TimeSpan.FromSeconds(current.game_time) - TimeSpan.FromSeconds(old.game_time);
// It prevents the addition of a negative value (can happen while loading a save on some maps)
if (incremental_time.Ticks > 0) {
vars.ingame_time += incremental_time;
}
}
}
gameTime
{
return vars.ingame_time;
}
isLoading
{
// Prevents the use of the LiveSplit timer to use ingame time
return true;
}