diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 266323b5f..bc3d20ba2 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4831,6 +4831,26 @@ static void toggle_sprite_alignment(int32_t spritenum) asksave = 1; } +static void toggle_cf_flipping(int32_t sectnum, int32_t floorp) +{ + static const int8_t next3[8] = { 6, 7, 4, 5, 0, 1, 3, 2 }; // 0->6->3->5->1->7->2->4->0 + static const int8_t prev3[8] = { 4, 5, 7, 6, 2, 3, 0, 1 }; // 0<-6<-3<-5<-1<-7<-2<-4<-0 + + static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 }; + + int16_t *stat = &SECTORFLD(sectnum,stat, floorp); + int32_t i = *stat; + + i = (i&0x4)+((i>>4)&3); + i = eitherSHIFT ? prev3[i] : next3[i]; + message("Sector %d %s flip %d deg%s", searchsector, typestr[searchstat], + klabs(orient[i])%360, orient[i] < 0 ? " mirrored":""); + i = (i&0x4)+((i&3)<<4); + *stat &= ~0x34; + *stat |= i; + asksave = 1; +} + ////////// KEY PRESS HANDLER IN 3D MODE ////////// static void Keys3d(void) { @@ -5717,24 +5737,7 @@ static void Keys3d(void) asksave = 1; } else if (AIMING_AT_CEILING_OR_FLOOR) //8-way ceiling/floor flipping (bits 2,4,5) - { - static const int8_t next3[8] = { 6, 7, 4, 5, 0, 1, 3, 2 }; // 0->6->3->5->1->7->2->4->0 - static const int8_t prev3[8] = { 4, 5, 7, 6, 2, 3, 0, 1 }; // 0<-6<-3<-5<-1<-7<-2<-4<-0 - - static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 }; - - int16_t *stat = &SECTORFLD(searchsector,stat, AIMING_AT_FLOOR); - - i = *stat; - i = (i&0x4)+((i>>4)&3); - i = eitherSHIFT ? prev3[i] : next3[i]; - message("Sector %d %s flip %d deg%s", searchsector, typestr[searchstat], - klabs(orient[i])%360, orient[i] < 0 ? " mirrored":""); - i = (i&0x4)+((i&3)<<4); - *stat &= ~0x34; - *stat |= i; - asksave = 1; - } + toggle_cf_flipping(searchsector, AIMING_AT_FLOOR); else if (AIMING_AT_SPRITE) { i = sprite[searchwall].cstat; @@ -7954,6 +7957,11 @@ static void Keys2d(void) { FuncMenu(); } + else if (!eitherALT && PRESSED_KEYSC(F)) + { + if (pointhighlight < 16384 && tcursectornum>=0 && graphicsmode) + toggle_cf_flipping(tcursectornum, 1); + } tsign = 0; if (PRESSED_KEYSC(LBRACK)) // [ search backward