mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
Debug: Add more details flag inside SpriteGroupDumper
This commit is contained in:
parent
5b6c0c1f2e
commit
e680cffb6d
@ -623,6 +623,7 @@ struct NewGRFInspectWindow : Window {
|
||||
::DrawString(ir.left, ir.right, ir.top + (scroll_offset * this->resize.step_height), buf, colour);
|
||||
});
|
||||
dumper.use_shadows = this->sprite_dump_unopt;
|
||||
dumper.more_details = HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL);
|
||||
nih->SpriteDump(index, dumper);
|
||||
return;
|
||||
} else {
|
||||
|
@ -480,7 +480,7 @@ static char *GetAdjustOperationName(char *str, const char *last, DeterministicSp
|
||||
return str + seprintf(str, last, "\?\?\?(0x%X)", operation);
|
||||
}
|
||||
|
||||
static char *DumpSpriteGroupAdjust(char *p, const char *last, const DeterministicSpriteGroupAdjust &adjust, const char *padding, uint32 &highlight_tag, uint &conditional_indent)
|
||||
char *SpriteGroupDumper::DumpSpriteGroupAdjust(char *p, const char *last, const DeterministicSpriteGroupAdjust &adjust, const char *padding, uint32 &highlight_tag, uint &conditional_indent)
|
||||
{
|
||||
if (adjust.variable == 0x7D) {
|
||||
/* Temp storage load */
|
||||
@ -503,10 +503,10 @@ static char *DumpSpriteGroupAdjust(char *p, const char *last, const Deterministi
|
||||
if (adjust.adjust_flags & DSGAF_SKIP_ON_LSB_SET) {
|
||||
p += seprintf(p, last, ", skip on LSB set");
|
||||
}
|
||||
if (adjust.adjust_flags & DSGAF_LAST_VAR_READ && HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL)) {
|
||||
if (adjust.adjust_flags & DSGAF_LAST_VAR_READ && this->more_details) {
|
||||
p += seprintf(p, last, ", last var read");
|
||||
}
|
||||
if (adjust.adjust_flags & DSGAF_JUMP_INS_HINT && HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL)) {
|
||||
if (adjust.adjust_flags & DSGAF_JUMP_INS_HINT && this->more_details) {
|
||||
p += seprintf(p, last, ", jump ins hint");
|
||||
}
|
||||
if (adjust.adjust_flags & DSGAF_END_BLOCK) {
|
||||
@ -619,7 +619,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
|
||||
char extra_info[64] = "";
|
||||
if (sg->sg_flags & SGF_ACTION6) strecat(extra_info, " (action 6 modified)", lastof(extra_info));
|
||||
if (sg->sg_flags & SGF_SKIP_CB) strecat(extra_info, " (skip CB)", lastof(extra_info));
|
||||
if (HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL)) {
|
||||
if (this->more_details) {
|
||||
if (sg->sg_flags & SGF_INLINING) strecat(extra_info, " (inlining)", lastof(extra_info));
|
||||
}
|
||||
|
||||
@ -719,7 +719,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
|
||||
char *p = this->buffer;
|
||||
p += seprintf(p, lastof(this->buffer), "%sDeterministic (%s, %s)%s [%u]",
|
||||
padding, get_scope_name(dsg->var_scope, dsg->var_scope_count), _sg_size_names[dsg->size], extra_info, dsg->nfo_line);
|
||||
if (HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL)) {
|
||||
if (this->more_details) {
|
||||
if (dsg->dsg_flags & DSGF_NO_DSE) p += seprintf(p, lastof(this->buffer), ", NO_DSE");
|
||||
if (dsg->dsg_flags & DSGF_VAR_TRACKING_PENDING) p += seprintf(p, lastof(this->buffer), ", VAR_PENDING");
|
||||
if (dsg->dsg_flags & DSGF_REQUIRES_VAR1C) p += seprintf(p, lastof(this->buffer), ", REQ_1C");
|
||||
@ -735,7 +735,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
|
||||
sub_padding += " ";
|
||||
uint conditional_indent = 0;
|
||||
for (const auto &adjust : (*adjusts)) {
|
||||
DumpSpriteGroupAdjust(this->buffer, lastof(this->buffer), adjust, sub_padding.c_str(), highlight_tag, conditional_indent);
|
||||
this->DumpSpriteGroupAdjust(this->buffer, lastof(this->buffer), adjust, sub_padding.c_str(), highlight_tag, conditional_indent);
|
||||
print();
|
||||
if (adjust.variable == 0x7E && adjust.subroutine != nullptr) {
|
||||
std::string subroutine_padding(sub_padding);
|
||||
@ -761,7 +761,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
|
||||
p += seprintf(p, lastof(this->buffer), " (%s)", cb_name);
|
||||
}
|
||||
}
|
||||
if (HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL) && range.group == dsg->error_group) {
|
||||
if (this->more_details && range.group == dsg->error_group) {
|
||||
p += seprintf(p, lastof(this->buffer), " (error_group)");
|
||||
}
|
||||
print();
|
||||
@ -770,7 +770,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
|
||||
if (default_group != nullptr) {
|
||||
char *p = this->buffer;
|
||||
p += seprintf(p, lastof(this->buffer), "%sdefault", padding);
|
||||
if (HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL) && default_group == dsg->error_group) {
|
||||
if (this->more_details && default_group == dsg->error_group) {
|
||||
p += seprintf(p, lastof(this->buffer), " (error_group)");
|
||||
}
|
||||
print();
|
||||
|
@ -771,6 +771,7 @@ using DumpSpriteGroupPrinter = std::function<void(const SpriteGroup *, DumpSprit
|
||||
|
||||
struct SpriteGroupDumper {
|
||||
bool use_shadows = false;
|
||||
bool more_details = false;
|
||||
|
||||
private:
|
||||
char buffer[1024];
|
||||
@ -785,6 +786,7 @@ private:
|
||||
SGDF_RANGE = 1 << 1,
|
||||
};
|
||||
|
||||
char *DumpSpriteGroupAdjust(char *p, const char *last, const DeterministicSpriteGroupAdjust &adjust, const char *padding, uint32 &highlight_tag, uint &conditional_indent);
|
||||
void DumpSpriteGroup(const SpriteGroup *sg, const char *prefix, uint flags);
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user