Undefine preprocessor defines that conflict across source files

This commit is contained in:
ROllerozxa 2026-06-07 16:34:45 +02:00
commit 76bd4d9c70
18 changed files with 53 additions and 14 deletions

View file

@ -125,3 +125,4 @@ bomber::attack(int add_cooldown)
this->attack_timer += add_cooldown;
}
#undef SHOOT_VELOCITY

View file

@ -1051,3 +1051,6 @@ plug_base::on_release(game *g)
}
}
}
#undef QUALITY
#undef WIDTH

View file

@ -5,7 +5,7 @@
#include "fxemitter.hh"
#include "game.hh"
#define FORCE 300.f
#define BOOM_FORCE 300.f
explosive::explosive(int explosive_type)
{
@ -165,7 +165,7 @@ explosive::trigger()
b2Vec2 p = this->get_position();
W->explode(this, trigger_point, this->get_layer(), 20,
(W->level.version >= LEVEL_VERSION_1_5 ? FORCE*this->properties[2].v.f : FORCE),
(W->level.version >= LEVEL_VERSION_1_5 ? BOOM_FORCE*this->properties[2].v.f : BOOM_FORCE),
this->properties[1].v.f,
(W->level.version >= LEVEL_VERSION_1_5 ? .5f : 1.f)
);
@ -222,3 +222,5 @@ explosive::on_slider_change(int s, float value)
G->show_numfeed(this->properties[1].v.f);
}
}
#undef BOOM_FORCE

View file

@ -6,8 +6,7 @@
#define NUM_RAYS 5
#define RAY_LENGTH 10.f
#define FAN_WIDTH 1.f
#define FORCE 2.f
#define FAN_FORCE 2.f
fan::fan()
: blade_rot(0.f)
@ -137,7 +136,7 @@ fan::solve_electronics()
return this->s_in[0].get_connected_edevice();
}
this->force = (this->s_in[0].get_value() * FORCE) / (float)NUM_RAYS;
this->force = (this->s_in[0].get_value() * FAN_FORCE) / (float)NUM_RAYS;
return 0;
}
@ -159,3 +158,8 @@ fan::cb_handler::ReportFixture(b2Fixture *f, const b2Vec2 &pt, const b2Vec2 &nor
return -1.f;
}
#undef NUM_RAYS
#undef RAY_LENGTH
#undef FAN_WIDTH
#undef FAN_FORCE

View file

@ -525,3 +525,7 @@ lmotor::restore()
j->SetMaxMotorForce(this->_force);
}
}
#undef SPEED
#undef FORCE
#undef FRICTION

View file

@ -96,3 +96,5 @@ lobber::attack(int add_cooldown)
this->attack_timer = LOBBER_RELOAD_TIME;
this->attack_timer += add_cooldown;
}
#undef SHOOT_VELOCITY

View file

@ -422,3 +422,6 @@ motor::on_slider_change(int s, float value)
G->show_numfeed(value * 8.f * SPEED);
}
}
#undef SPEED
#undef TORQUE

View file

@ -1992,3 +1992,4 @@ plant::set_position(float x, float y, uint8_t frame)
}
}
#undef QUALITY

View file

@ -714,3 +714,5 @@ ragdoll::on_slider_change(int s, float value)
this->recreate_head_joint(true);
}
}
#undef FRICTION

View file

@ -540,3 +540,6 @@ robot::modify_aim(float da)
w->set_arm_angle(w->get_arm_angle() + da, 0.1f);
}
#undef HEAD_SPEED_UP
#undef HEAD_SPEED_DOWN

View file

@ -4713,3 +4713,5 @@ robot_parts::pickaxe::pickaxe(creature *c)
this->mass = 0.375f;
this->plant_dmg_multiplier = .4f;
}
#undef HEAD_SPEED_UP

View file

@ -778,3 +778,5 @@ void
rope::step()
{
}
#undef WIDTH

View file

@ -337,3 +337,6 @@ rubberband_1::step(void)
}
}
}
#undef WIDTH
#undef MIN_WIDTH

View file

@ -242,8 +242,6 @@ presolve_cog_cog(b2Contact *contact, entity *a, entity *b, int rev, const b2Mani
double diff = a2-a1;
#define EPS .1f
//if ()
//
//if (fabsf(a1) < .2f) tms_infof("A1 ALLOWED");
@ -261,7 +259,7 @@ presolve_cog_cog(b2Contact *contact, entity *a, entity *b, int rev, const b2Mani
*/
//if (fabsf(diff) > EPS && fabsf(diff) < (1.f-EPS)) {
if (std::abs(diff) < EPS) {
if (std::abs(diff) < .1f) {
contact->SetEnabled(false);
/* attach the gears to each other */

View file

@ -475,3 +475,9 @@ void sticky::update(void) {
tmat3_copy_mat4_sub3x3(this->N, this->M);
}
}
#undef WIDTH
#undef HEIGHT
#undef TEX_WIDTH
#undef TEX_HEIGHT

View file

@ -22,6 +22,9 @@ struct textbuf_vert {
textbuf_vert textbuffer::base[4];
#define TEX_WIDTH 1024.f
#define TEX_HEIGHT 1024.f
void textbuffer::_init()
{
tms_infof("Initializing textbuffer...");
@ -161,9 +164,6 @@ textbuffer::add_char(glyph *gl,
int tx = 530;
int ty = 1024;
#define TEX_WIDTH 1024.f
#define TEX_HEIGHT 1024.f
tvec2 uvb = {(float)bx / TEX_WIDTH, (float)by / TEX_HEIGHT};
tvec2 uvt = {(float)tx / TEX_WIDTH, (float)ty / TEX_HEIGHT};
@ -238,9 +238,6 @@ textbuffer::add_char2(glyph *gl,
int tx = 530;
int ty = 1024;
#define TEX_WIDTH 1024.f
#define TEX_HEIGHT 1024.f
tvec2 uvb = {(float)bx / TEX_WIDTH, (float)by / TEX_HEIGHT};
tvec2 uvt = {(float)tx / TEX_WIDTH, (float)ty / TEX_HEIGHT};
@ -422,3 +419,6 @@ textbuffer::add_text2(const char *text, p_font *font,
}
}
}
#undef TEX_WIDTH
#undef TEX_HEIGHT

View file

@ -303,3 +303,4 @@ trampoline::tpad::update()
tmat3_copy_mat4_sub3x3(this->N, this->M);
}
#undef SPEED

View file

@ -3114,3 +3114,5 @@ world::query_aabb(b2QueryCallback *callback,
G->unlock();
#endif
}
#undef RAY_LENGTH