Revision 76dc4e0b main.c

View differences:

main.c
72 72

  
73 73
typedef struct player {
74 74
	volatile uint16_t score;
75
	volatile uint16_t oldScore;
75 76
	volatile int8_t gameAreaStart;
76 77
	volatile int8_t gameAreaEnd;
77 78
	volatile sprite_t sprite;
......
126 127

  
127 128
	// init player
128 129
	player[0].score = 0;
130
	player[0].oldScore = 0;
129 131
	player[0].gameAreaStart = 0;
130 132
	player[0].gameAreaEnd = 28;
131 133
	player[0].sprite.owner = (player_t*)&player[0];
......
137 139
	setNewSprite((sprite_t*)&(player[0].nextSprite));
138 140
	// next one
139 141
	player[1].score = 0;
142
	player[1].oldScore = 0;
140 143
	player[1].gameAreaStart = 37;
141 144
	player[1].gameAreaEnd = 65;
142 145
	player[1].sprite.owner = (player_t*)&player[1];
......
162 165
			clearCompleteLines((player_t*)&player[playerNumber]);
163 166
			moveFlyingRowsDown((player_t*)&player[playerNumber]);
164 167
		}
168
		if((player[0].score > 5)
169
		  && (player[0].score-2>=player[0].oldScore)
170
		  && (player[0].gameAreaEnd-player[0].gameAreaStart > 12)    // avoid way to small
171
		  && (player[1].gameAreaEnd-player[1].gameAreaStart > 12)){ // game areas.
172
			player[0].gameAreaEnd++;
173
			player[1].gameAreaStart++;
174
		}
175
		if((player[1].score > 5)
176
		  && (player[1].score-2>=player[1].oldScore)
177
		  && (player[0].gameAreaEnd-player[0].gameAreaStart > 12)    // avoid way to small
178
		  && (player[1].gameAreaEnd-player[1].gameAreaStart > 12)){ // game areas.
179
			player[0].gameAreaEnd--;
180
			player[1].gameAreaStart--;
181
		}
182
		player[0].oldScore = player[0].score;
183
		player[1].oldScore = player[1].score;
165 184
	}
166 185
}
167 186

  

Also available in: Unified diff