Skip to content

Commit 637af52

Browse files
committed
temple complex: moved hardcoded images id to config
1 parent cebbaaa commit 637af52

File tree

2 files changed

+113
-86
lines changed

2 files changed

+113
-86
lines changed

src/building/building_temple_complex.cpp

+68-81
Original file line numberDiff line numberDiff line change
@@ -37,67 +37,54 @@ int building_temple_complex::static_params_t<T>::planer_update_relative_orientat
3737

3838
template<class T>
3939
void building_temple_complex::static_params_t<T>::planer_setup_preview_graphics(build_planner &planer) const {
40-
int packid = -1;
41-
switch (this->TYPE) {
42-
case BUILDING_TEMPLE_COMPLEX_OSIRIS: packid = PACK_TEMPLE_NILE; break;
43-
case BUILDING_TEMPLE_COMPLEX_RA: packid = PACK_TEMPLE_RA; break;
44-
case BUILDING_TEMPLE_COMPLEX_PTAH: packid = PACK_TEMPLE_PTAH; break;
45-
case BUILDING_TEMPLE_COMPLEX_SETH: packid = PACK_TEMPLE_SETH; break;
46-
case BUILDING_TEMPLE_COMPLEX_BAST: packid = PACK_TEMPLE_BAST; break;
47-
break;
48-
}
49-
50-
int main_image_id = this->anim["main_image"].first_img();
51-
int oracle_image_id = image_id_from_group(packid, 2);
52-
int altar_image_id = image_id_from_group(packid, 3);
53-
int flooring_image_id = image_id_from_group(packid, 4);
54-
int statue1_image_id = image_id_from_group(packid, 5);
55-
int statue2_image_id = image_id_from_group(packid, 6);
40+
int flooring_image_id = this->anim["tiles"].first_img();
41+
int statue1_image_id = this->anim["statue_1"].first_img();
42+
int statue2_image_id = this->anim["statue_2"].first_img();
5643

5744
int EMPTY = 0;
58-
int mn_1A = main_image_id;
59-
int mn_1B = main_image_id + 3;
60-
int mn_2A = oracle_image_id;
61-
int mn_2B = oracle_image_id + 3;
62-
int mn_3A = altar_image_id;
63-
int mn_3B = altar_image_id + 3;
64-
65-
int til_0 = flooring_image_id + 0;
66-
int til_1 = flooring_image_id + 1;
67-
int til_2 = flooring_image_id + 2;
68-
int til_3 = flooring_image_id + 3;
69-
70-
int smst0 = statue1_image_id + 0; // north
71-
int smst1 = statue1_image_id + 1; // east
72-
int smst2 = statue1_image_id + 2; // south
73-
int smst3 = statue1_image_id + 3; // west
74-
75-
int lst0A = statue2_image_id + 0; // north
76-
int lst0B = statue2_image_id + 1;
77-
int lst1A = statue2_image_id + 2; // east
78-
int lst1B = statue2_image_id + 3;
79-
int lst2A = statue2_image_id + 4; // south
80-
int lst2B = statue2_image_id + 5;
81-
int lst3A = statue2_image_id + 6; // west
82-
int lst3B = statue2_image_id + 7;
45+
int main_n = this->anim["main_n"].first_img();
46+
int main_w = this->anim["main_w"].first_img();
47+
int oracle_n = this->anim["oracle_n"].first_img();
48+
int oracle_e = this->anim["oracle_w"].first_img();
49+
int altar_n = this->anim["altar_n"].first_img();
50+
int altar_w = this->anim["altar_w"].first_img();
51+
52+
int tiles_0 = flooring_image_id + 0;
53+
int tiles_1 = flooring_image_id + 1;
54+
int tiles_2 = flooring_image_id + 2;
55+
int tiles_3 = flooring_image_id + 3;
56+
57+
int statue_0 = statue1_image_id + 0; // north
58+
int statue_1 = statue1_image_id + 1; // east
59+
int statue_2 = statue1_image_id + 2; // south
60+
int statue_3 = statue1_image_id + 3; // west
61+
62+
int statue_2n_F = statue2_image_id + 0; // north
63+
int statue_2n_B = statue2_image_id + 1;
64+
int statue_2e_A = statue2_image_id + 2; // east
65+
int statue_2e_B = statue2_image_id + 3;
66+
int statue_2s_A = statue2_image_id + 4; // south
67+
int statue_2s_B = statue2_image_id + 5;
68+
int statue_2w_A = statue2_image_id + 6; // west
69+
int statue_2w_B = statue2_image_id + 7;
8370

8471
switch (planer.relative_orientation) {
8572
case 0:
8673
{ // NE
8774
int TEMPLE_COMPLEX_SCHEME[13][7] = {
88-
{til_3, lst1A, lst1B, til_1, lst3A, lst3B, til_3},
89-
{til_2, lst1A, lst1B, til_1, lst3A, lst3B, til_2},
90-
{til_3, lst1A, lst1B, til_1, lst3A, lst3B, til_3},
91-
{til_2, til_0, til_0, til_1, til_0, til_0, til_2},
92-
{til_0, til_0, EMPTY, EMPTY, EMPTY, til_0, til_0},
93-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
94-
{smst3, til_0, mn_1B, EMPTY, EMPTY, til_0, smst1},
95-
{til_1, til_1, EMPTY, EMPTY, EMPTY, til_1, til_1},
96-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
97-
{smst3, til_0, mn_2B, EMPTY, EMPTY, til_0, smst1},
98-
{til_1, til_1, EMPTY, EMPTY, EMPTY, til_1, til_1},
99-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
100-
{smst3, til_0, mn_3B, EMPTY, EMPTY, til_0, smst1},
75+
{tiles_3, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_3},
76+
{tiles_2, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_2},
77+
{tiles_3, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_3},
78+
{tiles_2, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_2},
79+
{tiles_0, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, tiles_0},
80+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
81+
{statue_3, tiles_0, main_w, EMPTY, EMPTY, tiles_0, statue_1},
82+
{tiles_1, tiles_1, EMPTY, EMPTY, EMPTY, tiles_1, tiles_1},
83+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
84+
{statue_3, tiles_0, oracle_e, EMPTY, EMPTY, tiles_0, statue_1},
85+
{tiles_1, tiles_1, EMPTY, EMPTY, EMPTY, tiles_1, tiles_1},
86+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
87+
{statue_3, tiles_0, altar_w, EMPTY, EMPTY, tiles_0, statue_1},
10188
};
10289
planer.set_graphics_array(make_span((int*)TEMPLE_COMPLEX_SCHEME, std::size(TEMPLE_COMPLEX_SCHEME)), vec2i(7, 13));
10390
planer.pivot = { 2, 10 };
@@ -107,13 +94,13 @@ void building_temple_complex::static_params_t<T>::planer_setup_preview_graphics(
10794
case 1:
10895
{ // SE
10996
int TEMPLE_COMPLEX_SCHEME[7][13] = {
110-
{smst0, smst0, til_1, smst0, smst0, til_1, smst0, smst0, til_0, til_2, til_3, til_2, til_3},
111-
{til_0, til_0, til_1, til_0, til_0, til_1, til_0, til_0, til_0, til_0, lst2B, lst2B, lst2B},
112-
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, til_0, lst2A, lst2A, lst2A},
113-
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, til_1, til_1, til_1, til_1},
114-
{mn_1A, EMPTY, EMPTY, mn_2A, EMPTY, EMPTY, mn_3A, EMPTY, EMPTY, til_0, lst0B, lst0B, lst0B},
115-
{til_0, til_0, til_1, til_0, til_0, til_1, til_0, til_0, til_0, til_0, lst0A, lst0A, lst0A},
116-
{smst2, smst2, til_1, smst2, smst2, til_1, smst2, smst2, til_0, til_2, til_3, til_2, til_3},
97+
{statue_0, statue_0, tiles_1, statue_0, statue_0, tiles_1, statue_0, statue_0, tiles_0, tiles_2, tiles_3, tiles_2, tiles_3},
98+
{tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_0, tiles_0, statue_2s_B, statue_2s_B, statue_2s_B},
99+
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, tiles_0, statue_2s_A, statue_2s_A, statue_2s_A},
100+
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, tiles_1, tiles_1, tiles_1, tiles_1},
101+
{main_n, EMPTY, EMPTY, oracle_n, EMPTY, EMPTY, altar_n, EMPTY, EMPTY, tiles_0, statue_2n_B, statue_2n_B, statue_2n_B},
102+
{tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_0, tiles_0, statue_2n_F, statue_2n_F, statue_2n_F},
103+
{statue_2, statue_2, tiles_1, statue_2, statue_2, tiles_1, statue_2, statue_2, tiles_0, tiles_2, tiles_3, tiles_2, tiles_3},
117104
};
118105
planer.set_graphics_array(make_span((int*)TEMPLE_COMPLEX_SCHEME, std::size(TEMPLE_COMPLEX_SCHEME)), vec2i(13, 7));
119106
planer.pivot = { 0, 2 };
@@ -123,19 +110,19 @@ void building_temple_complex::static_params_t<T>::planer_setup_preview_graphics(
123110
case 2:
124111
{ // SW
125112
int TEMPLE_COMPLEX_SCHEME[13][7] = {
126-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
127-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
128-
{til_1, til_1, mn_1B, EMPTY, EMPTY, til_1, til_1},
129-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
130-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
131-
{til_1, til_1, mn_2B, EMPTY, EMPTY, til_1, til_1},
132-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
133-
{smst3, til_0, EMPTY, EMPTY, EMPTY, til_0, smst1},
134-
{til_0, til_0, mn_3B, EMPTY, EMPTY, til_0, til_0},
135-
{til_2, til_0, til_0, til_1, til_0, til_0, til_2},
136-
{til_3, lst1A, lst1B, til_1, lst3A, lst3B, til_3},
137-
{til_2, lst1A, lst1B, til_1, lst3A, lst3B, til_2},
138-
{til_3, lst1A, lst1B, til_1, lst3A, lst3B, til_3},
113+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
114+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
115+
{tiles_1, tiles_1, main_w, EMPTY, EMPTY, tiles_1, tiles_1},
116+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
117+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
118+
{tiles_1, tiles_1, oracle_e, EMPTY, EMPTY, tiles_1, tiles_1},
119+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
120+
{statue_3, tiles_0, EMPTY, EMPTY, EMPTY, tiles_0, statue_1},
121+
{tiles_0, tiles_0, altar_w, EMPTY, EMPTY, tiles_0, tiles_0},
122+
{tiles_2, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_2},
123+
{tiles_3, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_3},
124+
{tiles_2, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_2},
125+
{tiles_3, statue_2e_A, statue_2e_B, tiles_1, statue_2w_A, statue_2w_B, tiles_3},
139126
};
140127
planer.set_graphics_array(make_span((int*)TEMPLE_COMPLEX_SCHEME, std::size(TEMPLE_COMPLEX_SCHEME)), vec2i(7, 13));
141128
planer.pivot = { 2, 0 };
@@ -145,13 +132,13 @@ void building_temple_complex::static_params_t<T>::planer_setup_preview_graphics(
145132
case 3:
146133
{ // NW
147134
int TEMPLE_COMPLEX_SCHEME[7][13] = {
148-
{til_3, til_2, til_3, til_2, til_0, smst0, smst0, til_1, smst0, smst0, til_1, smst0, smst0},
149-
{lst2B, lst2B, lst2B, til_0, til_0, til_0, til_0, til_1, til_0, til_0, til_1, til_0, til_0},
150-
{lst2A, lst2A, lst2A, til_0, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
151-
{til_1, til_1, til_1, til_1, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
152-
{lst0B, lst0B, lst0B, til_0, mn_1A, EMPTY, EMPTY, mn_2A, EMPTY, EMPTY, mn_3A, EMPTY, EMPTY},
153-
{lst0A, lst0A, lst0A, til_0, til_0, til_0, til_0, til_1, til_0, til_0, til_1, til_0, til_0},
154-
{til_3, til_2, til_3, til_2, til_0, smst2, smst2, til_1, smst2, smst2, til_1, smst2, smst2},
135+
{tiles_3, tiles_2, tiles_3, tiles_2, tiles_0, statue_0, statue_0, tiles_1, statue_0, statue_0, tiles_1, statue_0, statue_0},
136+
{statue_2s_B, statue_2s_B, statue_2s_B, tiles_0, tiles_0, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0},
137+
{statue_2s_A, statue_2s_A, statue_2s_A, tiles_0, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
138+
{tiles_1, tiles_1, tiles_1, tiles_1, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
139+
{statue_2n_B, statue_2n_B, statue_2n_B, tiles_0, main_n, EMPTY, EMPTY, oracle_n, EMPTY, EMPTY, altar_n, EMPTY, EMPTY},
140+
{statue_2n_F, statue_2n_F, statue_2n_F, tiles_0, tiles_0, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0, tiles_1, tiles_0, tiles_0},
141+
{tiles_3, tiles_2, tiles_3, tiles_2, tiles_0, statue_2, statue_2, tiles_1, statue_2, statue_2, tiles_1, statue_2, statue_2},
155142
};
156143
planer.set_graphics_array(make_span((int*)TEMPLE_COMPLEX_SCHEME, std::size(TEMPLE_COMPLEX_SCHEME)), vec2i(13, 7));
157144
planer.pivot = { 10, 2 };

src/scripts/buildings.js

+45-5
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,15 @@ building building_scribal_school = {
18881888
building building_temple_complex_osiris = {
18891889
animations : {
18901890
preview : { pack:PACK_GENERAL, id:42},
1891-
main_image : { pack:PACK_TEMPLE_NILE, id:1 },
1891+
main_n : { pack:PACK_TEMPLE_NILE, id:1 },
1892+
main_w : { pack:PACK_TEMPLE_NILE, id:1, offset:3 },
1893+
oracle_n : { pack:PACK_TEMPLE_NILE, id:2 },
1894+
oracle_w : { pack:PACK_TEMPLE_NILE, id:2, offset:3 },
1895+
altar_n : { pack:PACK_TEMPLE_NILE, id:3 },
1896+
altar_w : { pack:PACK_TEMPLE_NILE, id:3, offset:3 },
1897+
tiles : { pack:PACK_TEMPLE_NILE, id:4 },
1898+
statue_1 : { pack:PACK_TEMPLE_NILE, id:5 },
1899+
statue_2 : { pack:PACK_TEMPLE_NILE, id:6 },
18921900
},
18931901

18941902
building_size : 3,
@@ -1901,7 +1909,15 @@ building building_temple_complex_osiris = {
19011909
building building_temple_complex_ra = {
19021910
animations : {
19031911
preview : { pack:PACK_GENERAL, id:42},
1904-
main_image : { pack:PACK_TEMPLE_RA, id:1 },
1912+
main_n : { pack:PACK_TEMPLE_RA, id:1 },
1913+
main_w : { pack:PACK_TEMPLE_RA, id:1, offset:3 },
1914+
oracle_n : { pack:PACK_TEMPLE_RA, id:2 },
1915+
oracle_w : { pack:PACK_TEMPLE_RA, id:2, offset:3 },
1916+
altar_n : { pack:PACK_TEMPLE_RA, id:3 },
1917+
altar_w : { pack:PACK_TEMPLE_RA, id:3, offset:3 },
1918+
tiles : { pack:PACK_TEMPLE_RA, id:4 },
1919+
statue_1 : { pack:PACK_TEMPLE_RA, id:5 },
1920+
statue_2 : { pack:PACK_TEMPLE_RA, id:6 },
19051921
},
19061922

19071923
building_size : 3,
@@ -1914,7 +1930,15 @@ building building_temple_complex_ra = {
19141930
building building_temple_complex_ptah = {
19151931
animations : {
19161932
preview : { pack:PACK_GENERAL, id:42},
1917-
main_image : { pack:PACK_TEMPLE_PTAH, id:1 },
1933+
main_n : { pack:PACK_TEMPLE_PTAH, id:1 },
1934+
main_w : { pack:PACK_TEMPLE_PTAH, id:1, offset:3 },
1935+
oracle_n : { pack:PACK_TEMPLE_PTAH, id:2 },
1936+
oracle_w : { pack:PACK_TEMPLE_PTAH, id:2, offset:3 },
1937+
altar_n : { pack:PACK_TEMPLE_PTAH, id:3 },
1938+
altar_w : { pack:PACK_TEMPLE_PTAH, id:3, offset:3 },
1939+
tiles : { pack:PACK_TEMPLE_PTAH, id:4 },
1940+
statue_1 : { pack:PACK_TEMPLE_PTAH, id:5 },
1941+
statue_2 : { pack:PACK_TEMPLE_PTAH, id:6 },
19181942
},
19191943

19201944
building_size : 3,
@@ -1927,7 +1951,15 @@ building building_temple_complex_ptah = {
19271951
building building_temple_complex_seth = {
19281952
animations : {
19291953
preview : { pack:PACK_GENERAL, id:42},
1930-
main_image : { pack:PACK_TEMPLE_SETH, id:1 },
1954+
main_n : { pack:PACK_TEMPLE_SETH, id:1 },
1955+
main_w : { pack:PACK_TEMPLE_SETH, id:1, offset:3 },
1956+
oracle_n : { pack:PACK_TEMPLE_SETH, id:2 },
1957+
oracle_w : { pack:PACK_TEMPLE_SETH, id:2, offset:3 },
1958+
altar_n : { pack:PACK_TEMPLE_SETH, id:3 },
1959+
altar_w : { pack:PACK_TEMPLE_SETH, id:3, offset:3 },
1960+
tiles : { pack:PACK_TEMPLE_SETH, id:4 },
1961+
statue_1 : { pack:PACK_TEMPLE_SETH, id:5 },
1962+
statue_2 : { pack:PACK_TEMPLE_SETH, id:6 },
19311963
},
19321964

19331965
building_size : 3,
@@ -1940,7 +1972,15 @@ building building_temple_complex_seth = {
19401972
building building_temple_complex_bast = {
19411973
animations : {
19421974
preview : { pack:PACK_GENERAL, id:42},
1943-
main_image : { pack:PACK_TEMPLE_BAST, id:1 },
1975+
main_n : { pack:PACK_TEMPLE_BAST, id:1 },
1976+
main_w : { pack:PACK_TEMPLE_BAST, id:1, offset:3 },
1977+
oracle_n : { pack:PACK_TEMPLE_BAST, id:2 },
1978+
oracle_w : { pack:PACK_TEMPLE_BAST, id:2, offset:3 },
1979+
altar_n : { pack:PACK_TEMPLE_BAST, id:3 },
1980+
altar_w : { pack:PACK_TEMPLE_BAST, id:3, offset:3 },
1981+
tiles : { pack:PACK_TEMPLE_BAST, id:4 },
1982+
statue_1 : { pack:PACK_TEMPLE_BAST, id:5 },
1983+
statue_2 : { pack:PACK_TEMPLE_BAST, id:6 },
19441984
},
19451985

19461986
building_size : 3,

0 commit comments

Comments
 (0)