-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use ReDefine #6
Comments
As you see in only active ticket [except this one], ReDefine heavily lacks any real documentation (shocking, isn't it?) or any practical examples... i got lazy with whole thing as there was always something to fix/tweak in 1@2 :) Guess it's time to finally write proper documentation and release damn thing - so questions are welcome, i'll know on what parts to focus first. |
Re-compiling and comparing is a good idea, not sure why I didn't think about it right away. I did the same when testing optimization options for UP/RP. I'm not getting this about Also, does it re-process until there's a definitive version, or running it again might result in a yet tighter code? And, it appears to convert everything to windows crlf explicitly, is there a way to disable that? |
Actual
That depends on how complex [Script] sections are and how they're configured. 1@2 setup aims at most "packed" code, and uses a few tricks to achieve that in a single run. Some changes have different priority than others, some changes are in specific order, and in few cases [Script] setup forces processing current line again from scratch (after applying current changes), so previously skipped edits have a chance to run.
[ReDefine]->UnixNewlines=true should do the trick. |
It doesn't. But otherwise, after separating Still lots of debug, though. I suppose it needs to be cleaned as well?
What's this saying, what should be done about it? |
It failed to properly extract function from given line, as it thinks If you have same warning with regular function(s) giving "ignored" warnings and don't really want to mess with them, adding space between name and |
- yet another function extraction fix
I was using Windows version from 1@2: I didn't know this repo existed. Using a native version is certainly more pleasant. With latest master compiled, newlines work properly and debug size is reduced considerably. The last bulk source of clutter are debug messages:
ndebug is Also, one thing I just realized: scripts don't actually need to be compiled for comparing. Just preprocessing should be enough. In fact, it could probably be built directly into ReDefine, something like |
Thinking of that, maybe i should disable debug log for function extraction, and enable it only on demand. There's not much which can be done with it right now, other than various way of hiding it. I'm not sure what changes you want to catch; as long you don't have |
If that's the case, it's probably a good idea.
The changes that give heart attacks. I mean, those that actually alter the scripts rather than re-use defines. |
Looks like it uses macros directly from config, doesn't even check whether they are defined in the headers? @@ -272,8 +272,8 @@
end
procedure Node2217a begin
if ((item_caps_total(dude_obj)) >= 100) then begin
- item_caps_adjust(dude_obj, -100);
- item_caps_adjust(self_obj, 100);
+ dude_caps_adjust( -100);
+ self_caps_adjust( 100);
critter_heal(dude_obj, -((get_critter_stat(dude_obj,(35))) - (get_critter_stat(dude_obj,(7)))));
call Node022;
end else begin The above example could smarter about whitespace. While the one below could be dumber (no reason to change). if (obj_carrying_pid_obj(dude_obj, (17))) then
- item:=obj_carrying_pid_obj(dude_obj,(17));
+ item:=obj_carrying_pid_obj(dude_obj, (17));
else if (obj_carrying_pid_obj(dude_obj, (381))) then
- item:=obj_carrying_pid_obj(dude_obj,(381));
+ item:=obj_carrying_pid_obj(dude_obj, (381)); |
Yes. Headers are used only to get values for arguments, and nothing more.
That's with |
right |
Can you link to script from 2nd diff? |
Actually, a non-preprocessed version looks good: @@ -666,14 +666,14 @@ procedure NodeDoDermalUpgrade begin
variable item;
if (dude_caps > 33000 and (dude_item(PID_COMBAT_ARMOR) or dude_item(PID_COMBAT_ARMOR_MK_II) or dude_item(PID_BROTHERHOOD_COMBAT_ARMOR))) then
begin
- item_caps_adjust(dude_obj,-33000);
+ dude_caps_adjust(-33000);
if (dude_item(PID_COMBAT_ARMOR)) then//added check - killap
- item:=obj_carrying_pid_obj(dude_obj,PID_COMBAT_ARMOR);
+ item:=dude_item(PID_COMBAT_ARMOR);
//added by killap
else if (dude_item(PID_COMBAT_ARMOR_MK_II)) then
- item:=obj_carrying_pid_obj(dude_obj,PID_COMBAT_ARMOR_MK_II);
+ item:=dude_item(PID_COMBAT_ARMOR_MK_II);
else if (dude_item(PID_BROTHERHOOD_COMBAT_ARMOR)) then It's the preprocessed one that's different. I assume that's due to differences in ReDefine.cfg vs actual headers? |
Previously preprocessor replaced just PID so everything was at exactly same positions. Now it has to insert whole macro, including space between arguments :) |
OK, I'll just run compilation for comparing instead. It takes longer, but whatever. |
Hi. I couldn't find a separate repo for ReDefine, so I guess this is the only place where I can ask...
I'd like to try ReDefine for UP/RP, in order to reduce code volume further. As far I understand, it automatically processes headers, and replaces what's possible. That looks nice, but I have a few questions (and that's just getting started):
WARNING (IfArgumentIs) function<critter_add_trait> must be added to configuration before using this action : fileline<arroyo\acbrahmn.ssl:128> :: critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_ARROYO);
ref BGforgeNet/Fallout2_Unofficial_Patch#33
The text was updated successfully, but these errors were encountered: