From 1d0cb0716755d88fc071a5db528ffe54041d44fd Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 4 Feb 2012 21:33:52 +0000 Subject: [PATCH] Factor out four instances of identical code into M32_DrawRoomsAndMasks(). git-svn-id: https://svn.eduke32.com/eduke32@2314 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/editor.h | 2 + polymer/eduke32/build/src/build.c | 56 ++++++++++---------------- polymer/eduke32/source/astub.c | 35 +--------------- 3 files changed, 26 insertions(+), 67 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 1c5733b1f..30f11fe69 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -115,6 +115,8 @@ extern int32_t autogray, showinnergray; int32_t yax_is121(int16_t bunchnum, int16_t getfloor); #endif +extern void M32_DrawRoomsAndMasks(void); + extern int32_t kopen4loadfrommod(const char *filename, char searchfirst); // set to 1 to enable: diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index ffae4f3a0..05b8f7dcf 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -436,6 +436,26 @@ static void m32_keypresscallback(int32_t code, int32_t downp) VM_OnEvent(EVENT_KEYPRESS, -1); } +void M32_DrawRoomsAndMasks(void) +{ + yax_preparedrawrooms(); + drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); + yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum); + + ExtAnalyzeSprites(); + drawmasks(); + +#ifdef POLYMER + if (rendmode == 4 && searchit == 2) + { + polymer_editorpick(); + drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); + ExtAnalyzeSprites(); + drawmasks(); + } +#endif +} + #undef STARTUP_SETUP_WINDOW #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) # define STARTUP_SETUP_WINDOW @@ -677,22 +697,7 @@ CANCEL: ExtPreCheckKeys(); - yax_preparedrawrooms(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum); - - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif + M32_DrawRoomsAndMasks(); #ifdef M32_SHOWDEBUG if (searchstat>=0 && (searchwall<0 || searchsector<0)) @@ -8590,24 +8595,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha quitevent = 0; if ((flags&8)==0) - { - yax_preparedrawrooms(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum); - - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif - } + M32_DrawRoomsAndMasks(); ch = bgetchar(); if (keystatus[0x1]) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 153a9694a..9dd79092b 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4429,22 +4429,7 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int if (handleevents()) quitevent = 0; - yax_preparedrawrooms(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum); - - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif + M32_DrawRoomsAndMasks(); ch = bgetchar(); @@ -4639,23 +4624,7 @@ ENDFOR1: if (PRESSED_KEYSC(PGDN)) sprite[linebegspr].pal -= (sprite[linebegspr].pal>0); - - yax_preparedrawrooms(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum); - - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif + M32_DrawRoomsAndMasks(); ch = bgetchar();