This repository has been archived by the owner on Nov 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstarsign.cc
170 lines (157 loc) · 4.14 KB
/
starsign.cc
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include "jaakkos.h"
void starsign_select() {
int month;
uint32_t BIRTHSIGN_ADDR = 0;
uint32_t JUMP_TO = 0;
// Get ADOM version number, set by Sage
int adom_version = get_version();
/*
BIRTHSIGN_ADDR is the place in memory where the day of birth is stored.
Its value in memory will be the in-game displayed value minus one.
JUMP_TO is where to resume execution in the ADOM executable.
See http://www.adom.de/forums/showthread.php/1134-Choosing-star-sign?p=72882#post72882
for information on finding these offsets.
*/
if (adom_version == 111) {
BIRTHSIGN_ADDR = 0x82b61f0;
JUMP_TO = 0x813ee80;
}
else if (adom_version == 100) {
BIRTHSIGN_ADDR = 0x82a66e4;
JUMP_TO = 0x0813ace0;
}
else if (adom_version == 1203) {
BIRTHSIGN_ADDR = 0x8283d40;
JUMP_TO = 0x081386d0;
}
else if (adom_version == 1204) {
BIRTHSIGN_ADDR = 0x8285d40;
JUMP_TO = 0x8139fb0;
}
else if (adom_version == 1205) {
BIRTHSIGN_ADDR = 0x8286948;
JUMP_TO = 0x813a860;
}
else if (adom_version == 1206) {
BIRTHSIGN_ADDR = 0x828acbc;
JUMP_TO = 0x813bf70;
}
else if (adom_version == 1207) {
BIRTHSIGN_ADDR = 0x82921fc;
JUMP_TO = 0x81405a0;
}
else if (adom_version == 1208) {
BIRTHSIGN_ADDR = 0x8295a60;
JUMP_TO = 0x81418f0;
}
else if (adom_version == 1209) {
BIRTHSIGN_ADDR = 0x82a7d40;
JUMP_TO = 0x81458a0;
}
else if (adom_version == 12010) {
BIRTHSIGN_ADDR = 0x82a7e40;
JUMP_TO = 0x8145780;
}
else if (adom_version == 12011) {
BIRTHSIGN_ADDR = 0x82a6d20;
JUMP_TO = 0x8144910;
}
else if (adom_version == 12012) {
BIRTHSIGN_ADDR = 0x82b8c30;
JUMP_TO = 0x8144620;
}
else if (adom_version == 12013) {
BIRTHSIGN_ADDR = 0x82b8c90;
JUMP_TO = 0x8144690;
}
else if (adom_version == 12014) {
BIRTHSIGN_ADDR = 0x82bbf34;
JUMP_TO = 0x8145870;
}
else if (adom_version == 12016) {
BIRTHSIGN_ADDR = 0x82be774;
JUMP_TO = 0x8149090;
}
else if (adom_version == 12017) {
BIRTHSIGN_ADDR = 0x82e15b8;
JUMP_TO = 0x814a7c0;
}
else if (adom_version == 12018) {
BIRTHSIGN_ADDR = 0x82e1c58;
JUMP_TO = 0x814a040;
}
else if (adom_version == 12019) {
BIRTHSIGN_ADDR = 0x82e27fc;
JUMP_TO = 0x814a3b0;
}
else if (adom_version == 12020) {
BIRTHSIGN_ADDR = 0x82E277C;
JUMP_TO = 0x814a3b0;
}
else if (adom_version == 12021) {
BIRTHSIGN_ADDR = 0x83091bc;
JUMP_TO = 0x8156bc0;
}
else if (adom_version == 12022) {
BIRTHSIGN_ADDR = 0x830b1e0;
JUMP_TO = 0x81583e0;
}
else if (adom_version == 12023) {
BIRTHSIGN_ADDR = 0x0830c240;
JUMP_TO = 0x08158c20;
}
else if (adom_version == 12048) {
BIRTHSIGN_ADDR = 0x0834a6fc;
JUMP_TO = 0x081659b0;
}
else if (adom_version == 12049) {
BIRTHSIGN_ADDR = 0x0834bcbc;
JUMP_TO = 0x08166420;
}
else if (adom_version == 12051) {
BIRTHSIGN_ADDR = 0x084730a0;
JUMP_TO = 0x081719E0;
}
else if (adom_version == 12055) {
BIRTHSIGN_ADDR = 0x08474020;
JUMP_TO = 0x08172280;
}
else if (adom_version == 12059) {
BIRTHSIGN_ADDR = 0x08486ae0;
JUMP_TO = 0x0809dfd0;
}
if ((BIRTHSIGN_ADDR == 0) || (JUMP_TO == 0)) {
printf("Don't know where to put the birth date or jump to. Unknown ADOM version %i ?\n", adom_version);
return;
}
do {
printf("\033[2J\033[1;1H");
printf("\r\n\r\n\tSelect the month of your birth:\r\n"
"\r\n"
"\t\t [?] random\r\n"
"\r\n"
"\t\t [a] Raven\r\n"
"\t\t [b] Book\r\n"
"\t\t [c] Wand\r\n"
"\t\t [d] Unicorn\r\n"
"\t\t [e] Salamander\r\n"
"\t\t [f] Dragon\r\n"
"\t\t [g] Sword\r\n"
"\t\t [h] Falcon\r\n"
"\t\t [i] Cup\r\n"
"\t\t [j] Candle\r\n"
"\t\t [k] Wolf\r\n"
"\t\t [l] Tree\r\n"
"\r\n"
"\tYour choice: ");
fflush(stdout);
month = toupper(fgetc(stdin));
} while(month != '?' && (month < 'A' || month > 'L'));
printf("\033[2J");
fflush(stdout);
month = month == '?' ? 0 : month-'A'+1;
if(!month) month = rand() % 12;
else month--;
*((uint16_t*)BIRTHSIGN_ADDR) = (unsigned int)(30*month + (rand()%30));
((void(*)())JUMP_TO)();
}