From 6681cf2d0bcbca5785c0173f4ef5065423aba1a4 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 18 Oct 2018 07:20:23 +0000 Subject: Tweaks to catwalk demo. --- xd.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/xd.c b/xd.c index 3615634..47daed2 100644 --- a/xd.c +++ b/xd.c @@ -262,7 +262,7 @@ static DemoInfo demotbl[NO_DEMOS]= UsesPixmap }, { - "Catwalk trench", + "Catwalk trench (LMB to change draw mode)", CatwalkDemo, UsesPixmap }, @@ -3827,6 +3827,8 @@ static void CatwalkDemo(void) static int move=0; + static int drawmode = MODE_EDGE; + static int init=FALSE; int f,r; @@ -3844,7 +3846,8 @@ static void CatwalkDemo(void) catwalk[f].no_poly = 1; catwalk[f].origin.x = 0; - catwalk[f].origin.y = RND2(TRENCH_Y_BOT, TRENCH_Y_TOP + TRENCH_CWH); + catwalk[f].origin.y = RND2(TRENCH_Y_BOT - TRENCH_CWH, + TRENCH_Y_TOP + TRENCH_CWH); catwalk[f].origin.z = TRENCH_Z_MAX - 1500 * f; catwalk[f].ps = cw_point; @@ -3867,6 +3870,43 @@ static void CatwalkDemo(void) init=TRUE; } + if (mouse_b&Button1Mask) + { + static time_t bounce=0; + + if (bounce!=time(NULL)) + { + drawmode = (drawmode + 1) % 3; + + switch(drawmode) + { + case MODE_WIRE: + trench.mode = MODE_WIRE; + for(f = 0; f < no_catwalk; f++) + { + catwalk[f].mode = MODE_WIRE; + } + break; + case MODE_EDGE: + trench.mode = MODE_WIRE; + for(f = 0; f < no_catwalk; f++) + { + catwalk[f].mode = MODE_EDGE; + } + break; + case MODE_SOLID: + trench.mode = MODE_SOLID; + for(f = 0; f < no_catwalk; f++) + { + catwalk[f].mode = MODE_SOLID; + } + break; + } + + bounce=time(NULL); + } + } + Cls(); DrawObj(&trench,col); @@ -3890,7 +3930,8 @@ static void CatwalkDemo(void) catwalk[0] = t; catwalk[0].origin.z = TRENCH_Z_MAX; - catwalk[0].origin.y = RND2(TRENCH_Y_BOT, TRENCH_Y_TOP + TRENCH_CWH); + catwalk[0].origin.y = RND2(TRENCH_Y_BOT - TRENCH_CWH, + TRENCH_Y_TOP + TRENCH_CWH); } } -- cgit v1.2.3