Changeset 49 for libcaca/trunk/src/tunnel.c
- Timestamp:
- Dec 23, 2002, 10:28:37 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/tunnel.c
r37 r49 4 4 * All Rights Reserved 5 5 * 6 * $Id: tunnel.c,v 1. 4 2002/12/22 18:44:12sam Exp $6 * $Id: tunnel.c,v 1.5 2002/12/23 09:28:37 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 25 25 #include "common.h" 26 26 27 static void draw_wall( game *g, int *wall );27 static void draw_wall( game *g, int *wall, int delta ); 28 28 29 29 /* Init tunnel */ … … 40 40 if( t->w >= g->w ) 41 41 { 42 t->left[0] = -1 ;43 t->right[0] = g->w ;42 t->left[0] = -10; 43 t->right[0] = g->w + 10; 44 44 for( i = 0; i < g->h; i++ ) 45 45 { 46 t->left[i] = -1 ;47 t->right[i] = g->w ;46 t->left[i] = -10; 47 t->right[i] = g->w + 10; 48 48 } 49 49 } … … 72 72 { 73 73 /* Print tunnel */ 74 draw_wall( g, t->left );75 draw_wall( g, t->right );74 draw_wall( g, t->left, -2 ); 75 draw_wall( g, t->right, -1 ); 76 76 } 77 77 78 78 void update_tunnel( game *g, tunnel *t ) 79 79 { 80 static int const delta[] = { - 2, -1, 1, 2};80 static int const delta[] = { -3, -2, -1, 1, 2, 3 }; 81 81 int i,j,k; 82 82 … … 89 89 90 90 /* Generate new values */ 91 i = delta[GET_RAND(0, 4)];92 j = delta[GET_RAND(0, 4)];91 i = delta[GET_RAND(0,6)]; 92 j = delta[GET_RAND(0,6)]; 93 93 94 94 /* Check in which direction we need to alter tunnel */ … … 122 122 else 123 123 { 124 t->left[0] = -1 ;125 t->right[0] = g->w ;124 t->left[0] = -10; 125 t->right[0] = g->w + 10; 126 126 } 127 127 … … 152 152 } 153 153 154 static void draw_wall( game *g, int *wall )154 static void draw_wall( game *g, int *wall, int delta ) 155 155 { 156 156 int i; … … 162 162 char *str; 163 163 164 if( wall[i] < 0 || wall[i] >= g->w)164 if( wall[i] < -10 || wall[i] >= g->w + 10 ) 165 165 { 166 166 continue; … … 178 178 if( wall[i] == wall[i+1] + 2 ) 179 179 { 180 gfx_goto( wall[i] - 1 , i );180 gfx_goto( wall[i] - 1 + delta, i ); 181 181 gfx_putchar( '_' ); 182 182 } 183 183 184 gfx_goto( wall[i] , i );184 gfx_goto( wall[i] + delta, i ); 185 185 gfx_putstr( str ); 186 186 if( wall[i] == wall[i+1] - 2 ) gfx_putchar( '_' );
Note: See TracChangeset
for help on using the changeset viewer.