OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [actel_m1a3pl_dev_kit/] [software/] [spacewar/] [rocket1.c] - Blame information for rev 135

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 80 olivier.gi
#include "spacewar.h"
2
 
3
//************************************************************
4
// externals
5
//
6
extern volatile int xinit, yinit;
7
 
8
extern void cline(int, int);
9
extern void point(rkt_data *);
10
 
11
//************************************************************
12
//
13
// rkt1
14
//
15
//    draws rocket # 1
16
//
17
/* Description:
18
Draws rocket 1 made of five lines.  This rocket looks like the starship
19
enterprise.  Also draws rocket 1 torpedos as points.
20
*/
21
void rocket1(rkt_data *rkt1)
22
{
23
int dif_yx, sum_yx;
24
int xfin, yfin;
25
 
26
  dif_yx = (rkt1->ysize >> 1) - (rkt1->xsize >> 1);
27
  sum_yx = (rkt1->ysize >> 1) + (rkt1->xsize >> 1);
28
 
29
  xinit = rkt1->xdisp + rkt1->xsize;
30
  yinit = rkt1->ydisp + rkt1->ysize;
31
  xfin = rkt1->xdisp - (rkt1->xsize >> 1);
32
  yfin = rkt1->ydisp - (rkt1->ysize >> 1);
33
  cline(xfin, yfin);                      // draw line #1
34
 
35
  xfin = xinit - dif_yx;
36
  yfin = yinit + sum_yx;
37
  xinit -= sum_yx;
38
  yinit -= dif_yx;
39
  cline(xfin, yfin);                      // draw line #2
40
 
41
  xfin = xinit + sum_yx;
42
  yfin = yinit + dif_yx;
43
  cline(xfin, yfin);                      // draw line #3
44
 
45
  xfin = xinit + dif_yx;
46
  yfin = yinit - sum_yx;
47
  cline(xfin, yfin);                      // draw line #4
48
 
49
  xfin = xinit - sum_yx + dif_yx;
50
  yfin = yinit - sum_yx - dif_yx;
51
  cline(xfin, yfin);                      // draw line #5
52
 
53
  point(rkt1);                            // update and draw rkt1's torpedoes
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.