mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 03:20:44 +00:00
Mapster32: in manual member editing, Shift+ENTER allows toggling individual bits
For values that are displayed in hex. Patch by The Mechanic, with modifications. git-svn-id: https://svn.eduke32.com/eduke32@5338 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
80aa6eca58
commit
0943cd0e3f
1 changed files with 40 additions and 13 deletions
|
@ -10850,6 +10850,8 @@ static void handlemed(int32_t dohex, const char *disp_membername, const char *ed
|
||||||
int32_t flags = sign;
|
int32_t flags = sign;
|
||||||
sign &= 1;
|
sign &= 1;
|
||||||
|
|
||||||
|
assert(!dohex || thesizeof == sizeof(int16_t));
|
||||||
|
|
||||||
if (thesizeof==sizeof(int8_t))
|
if (thesizeof==sizeof(int8_t))
|
||||||
{
|
{
|
||||||
if (sign)
|
if (sign)
|
||||||
|
@ -10858,7 +10860,12 @@ static void handlemed(int32_t dohex, const char *disp_membername, const char *ed
|
||||||
val = *(uint8_t *)themember;
|
val = *(uint8_t *)themember;
|
||||||
}
|
}
|
||||||
else if (thesizeof==sizeof(int16_t))
|
else if (thesizeof==sizeof(int16_t))
|
||||||
|
{
|
||||||
val = *(int16_t *)themember;
|
val = *(int16_t *)themember;
|
||||||
|
// Bug fix : Do not sign extend when dealing with hex values
|
||||||
|
if (dohex)
|
||||||
|
val &= 0xFFFF;
|
||||||
|
}
|
||||||
else //if (thesizeof==sizeof(int32_t))
|
else //if (thesizeof==sizeof(int32_t))
|
||||||
val = *(int32_t *)themember;
|
val = *(int32_t *)themember;
|
||||||
|
|
||||||
|
@ -10870,9 +10877,28 @@ static void handlemed(int32_t dohex, const char *disp_membername, const char *ed
|
||||||
for (; i<med_dispwidth; i++)
|
for (; i<med_dispwidth; i++)
|
||||||
med_disptext[i] = ' ';
|
med_disptext[i] = ' ';
|
||||||
|
|
||||||
Bsprintf(med_edittext,"%s %d %s: ", med_typename, med_thenum, edit_membername);
|
|
||||||
if (med_editval)
|
if (med_editval)
|
||||||
{
|
{
|
||||||
|
// If editing a hex value and either SHIFT is pressed then toggle a specific bit
|
||||||
|
if (SHIFTS_IS_PRESSED && dohex)
|
||||||
|
{
|
||||||
|
// Get highest bit in maximum value
|
||||||
|
int32_t max_bit = 0;
|
||||||
|
while (max_bit < 15 && 1<<(max_bit+1) < themax)
|
||||||
|
max_bit++;
|
||||||
|
|
||||||
|
Bsprintf(med_edittext, "Toggle %s %d %s Bit 0..%d: ", med_typename, med_thenum, edit_membername, max_bit);
|
||||||
|
printmessage16("%s", med_edittext);
|
||||||
|
|
||||||
|
const int32_t bit = getnumber16(med_edittext, -1, max_bit, 1);
|
||||||
|
if (bit >= 0)
|
||||||
|
*(int16_t *)themember = (int16_t)((1<<bit) ^ (*(int16_t *)themember));
|
||||||
|
}
|
||||||
|
// Else directly edit value
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Bsprintf(med_edittext,"%s %d %s: ", med_typename, med_thenum, edit_membername);
|
||||||
|
|
||||||
printmessage16("%s", med_edittext);
|
printmessage16("%s", med_edittext);
|
||||||
val = getnumber16(med_edittext, val, themax, flags);
|
val = getnumber16(med_edittext, val, themax, flags);
|
||||||
|
|
||||||
|
@ -10888,6 +10914,7 @@ static void handlemed(int32_t dohex, const char *disp_membername, const char *ed
|
||||||
else //if (thesizeof==sizeof(int32_t))
|
else //if (thesizeof==sizeof(int32_t))
|
||||||
*(int32_t *)themember = val;
|
*(int32_t *)themember = val;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void med_printcurline(int32_t xpos, int32_t ypos, int32_t row, int32_t selected)
|
static void med_printcurline(int32_t xpos, int32_t ypos, int32_t row, int32_t selected)
|
||||||
|
|
Loading…
Reference in a new issue