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

Subversion Repositories openmsp430

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

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
 
7
//************************************************************
8
//
9
// reset
10
//
11
//    reset rkts for restart of program
12
//
13
/* Description:
14
Resets the rocket structure.  The xdisp = ydisp = position, ang = angle
15
passed into function.  Rockets x and y velocities are set to zero.
16
*/
17
void reset_one_rkt(rkt_data *rkt, int position, unsigned char angle)
18
{
19
 
20
  rkt->xdisp = position;    // position rkt in quadrant
21
  rkt->ydisp = position;
22
  rkt->xvel = 0;            // no velocity
23
  rkt->yvel = 0;
24
  rkt->ang = angle;         // point to angle
25
}
26
 
27
//************************************************************
28
//
29
// reset
30
//
31
//    reset rkts for restart of program
32
//
33
/* Description:
34
Reset the position, angle, and velecity of both rockets.
35
*/
36
void reset_rkts(rkt_data *rkt1, rkt_data *rkt2)
37
{
38
 
39
// setup rkt1 variables
40
  reset_one_rkt(rkt1, (max_dac * 3) / 4, 0);  // position rkt1 in quadrant 1
41
                                              // point to 3 o'clock
42
// setup rkt2 variables
43
  reset_one_rkt(rkt2, (max_dac * 1) / 4, 128); // position rkt2 in quadrant 3
44
                                              // point to 9 o'clock
45
}
46
 
47
//************************************************************
48
//
49
// reset game info for one rocket
50
//
51
//
52
/* Description:
53
Resets shield to full value, stops the torpedos from firing, and makes all
54
torpedos inactive for structure passed to function.
55
*/
56
void reset_game(rkt_data *rkt)
57
{
58
  int i;
59
 
60
  rkt->shield = full_shields ;          // restore all shields
61
  rkt->flags = 0;                       // clear all flags
62
 
63
  for (i=0; i < ammo; i++){             // stop all torps
64
    rkt->pt_dx[i] = -1;
65
  }
66
}
67
 

powered by: WebSVN 2.1.0

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