Skip to content

Commit aa98fa8

Browse files
committed
redo PROP stuff to use unions instead of voids (like tpt++), also remembers what you last entered.
1 parent 989dc83 commit aa98fa8

14 files changed

Lines changed: 392 additions & 258 deletions

File tree

build/readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ The-Fall - GEL and SPNG can absorb water from more elements (ex. PSTE + SPNG ->
4545
GIGATeun - GRVI (gravitons)
4646

4747

48+
mniip - hosts the update server
49+
iam4722202468 - made the bug font icon
50+
51+
4852

4953
------------------------------------------------------------------------------
5054
---------------------------------Explanations---------------------------------

includes/defines.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,14 @@ typedef unsigned int pixel;
172172
#endif
173173
#endif
174174

175+
enum PropertyType { ParticleType, Colour, Integer, UInteger, Float, String, Char, UChar };
176+
union PropertyValue
177+
{
178+
int Integer;
179+
unsigned int UInteger;
180+
float Float;
181+
};
182+
175183
#define SDEUT
176184

177185
#define DEBUG_PARTS 0x0001
@@ -220,9 +228,6 @@ extern int heatmode;
220228
extern int maxframes;
221229
extern int secret_els;
222230
extern int save_as;
223-
extern void *prop_value;
224-
extern int prop_format;
225-
extern unsigned int prop_offset;
226231
extern int tab_num;
227232
extern int num_tabs;
228233
extern int show_tabs;

includes/interface.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ void menu_count(void);
251251

252252
void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y);
253253

254-
void prop_edit_ui(pixel *vid_buf, int x, int y, int flood);
254+
extern int propSelected;
255+
extern char propValue[255];
256+
void prop_edit_ui(pixel *vid_buf);
255257

256258
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
257259

includes/powder.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,6 @@ static void create_gain_photon(int pp);
300300

301301
void kill_part(int i);
302302

303-
int FloodFillPmapCheck(int x, int y, int type);
304-
int flood_prop(int x, int y, size_t propoffset, void * propvalue, int proptype);
305-
306303
void detach(int i);
307304
int interactWavelengths(particle* cpart, int origWl);
308305
int getWavelengths(particle* cpart);
@@ -315,8 +312,6 @@ int get_brush_flags();
315312

316313
int create_part(int p, int x, int y, int t);
317314

318-
int create_property(int x, int y, size_t propoffset, void * propvalue, int proptype);
319-
320315
void delete_part(int x, int y, int flags);
321316

322317
int is_wire(int x, int y);

src/elements/powered.cpp

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,64 +45,82 @@ int update_POWERED(UPDATE_FUNC_ARGS) {
4545
{
4646
if (parts[r>>8].life>2)
4747
{
48-
int tentmp2 = 10, ninetmp2 = 9, skipmoveflags = parts[i].flags|FLAG_SKIPMOVE;
4948
if (parts[r>>8].ctype==PT_PSCN && parts[i].tmp2 < 10)
5049
{
51-
flood_prop(x,y,offsetof(particle, tmp2),&tentmp2,0);
52-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
50+
PropertyValue tempValue;
51+
tempValue.Integer = 10;
52+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, tmp2));
53+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
54+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
5355
}
5456
else if (parts[r>>8].ctype==PT_NSCN && parts[i].tmp2 >= 10)
5557
{
56-
flood_prop(x,y,offsetof(particle, tmp2),&ninetmp2,0);
57-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
58+
PropertyValue tempValue;
59+
tempValue.Integer = 9;
60+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, tmp2));
61+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
62+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
5863
}
5964
}
6065
}
6166
else if (parts[i].type == PT_ANIM)
6267
{
6368
if (parts[r>>8].life>2)
6469
{
65-
int tenlife = 10, ninelife = 9, fourteenlife = 14, zero = 0, skipmoveflags = parts[i].flags|FLAG_SKIPMOVE;
6670
if (parts[r>>8].ctype==PT_PSCN && parts[i].life < 10)
6771
{
68-
flood_prop(x,y,offsetof(particle, life),&tenlife,0);
69-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
72+
PropertyValue tempValue;
73+
tempValue.Integer = 10;
74+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
75+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
76+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
7077
}
7178
else if (parts[r>>8].ctype==PT_NSCN && (parts[i].life >= 10 || parts[i].tmp != (int)(parts[i].temp-273.15) || parts[i].tmp2 > 1))
7279
{
73-
flood_prop(x,y,offsetof(particle, life),&ninelife,0);
74-
flood_prop(x,y,offsetof(particle, tmp),&zero,0);
75-
flood_prop(x,y,offsetof(particle, tmp2),&zero,0);
76-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
80+
PropertyValue tempValue;
81+
tempValue.Integer = 9;
82+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
83+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
84+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
85+
tempValue.Integer = 0;
86+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, tmp));
87+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, tmp2));
7788
}
7889
else if (parts[r>>8].ctype==PT_METL)
7990
{
8091
if (parts[i].life == 10)
8192
{
82-
flood_prop(x,y,offsetof(particle, life),&ninelife,0);
83-
//flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
93+
PropertyValue tempValue;
94+
tempValue.Integer = 9;
95+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
8496
}
8597
else if (parts[i].life == 0)
8698
{
87-
flood_prop(x,y,offsetof(particle, life),&fourteenlife,0);
88-
//flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
99+
PropertyValue tempValue;
100+
tempValue.Integer = 14;
101+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
89102
return 0;
90103
}
91104
}
92105
}
93106
}
94107
else
95108
{
96-
int tenlife = 10, ninelife = 9, skipmoveflags = parts[i].flags|FLAG_SKIPMOVE;
97109
if (parts[r>>8].ctype==PT_PSCN && parts[i].life < 10)
98110
{
99-
flood_prop(x,y,offsetof(particle, life),&tenlife,0);
100-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
111+
PropertyValue tempValue;
112+
tempValue.Integer = 10;
113+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
114+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
115+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
101116
}
102117
else if (parts[r>>8].ctype==PT_NSCN && parts[i].life >= 10)
103118
{
104-
flood_prop(x,y,offsetof(particle, life),&ninelife,0);
105-
flood_prop(x,y,offsetof(particle, flags),&skipmoveflags,0);
119+
PropertyValue tempValue;
120+
tempValue.Integer = 9;
121+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, life));
122+
tempValue.Integer = parts[i].flags|FLAG_SKIPMOVE;
123+
globalSim->FloodProp(x, y, Integer, tempValue, offsetof(particle, flags));
106124
}
107125
else if ((parts[i].type == PT_SWCH || parts[i].type == PT_BUTN) && parts[r>>8].ctype != PT_PSCN && parts[r>>8].ctype != PT_NSCN && !(parts[r>>8].ctype == PT_INWR && parts[r>>8].tmp == 1) && parts[i].life == 10)
108126
{

0 commit comments

Comments
 (0)