File: scroll.c

package info (click to toggle)
gravitywars 1.102-34
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,468 kB
  • ctags: 553
  • sloc: ansic: 3,938; makefile: 52; sh: 52
file content (156 lines) | stat: -rw-r--r-- 2,368 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* GravityWars 1.1,  (C) Sami Niemi -95 */

#include "memory.h"
 
/*--------------------------------------------------------------- centerShip */
/* Centers the scrolling picture in Y direction */

void centerShip(short nr) {

  static short y;

  y=(sy[nr] >> STEP)-240;

  if (y<16)
    y=16;
  else
    if (y>960)
      y=960;
    
  gl_setdisplaystart(0,y);

#ifdef ANIM

  animate();

#endif
  

#ifdef SCORE
  if ((y>16) || (y<960) || (ScoreChange)){
                /* Don't draw the scoretable in the upper part of the screen */
    y+=8;       /* Why? - Because it's not moving....*/

    /*fixscore();*/
    killscore(nr,win_y,y);
    win_y=y;
    putscore(nr,win_y);
  }
#endif
}


/*------------------------------------------------------------------ scrollY */
/* Scroll the screen from y1 -> y2 */

void scrollY(short nr, short y1, short y2) {

  static int y,n;
  
  if ((y1<950) || (y2<950)) {     /* y2 -> changed ?????? */

    if (y1<16)
      y1=16;
    else
      if (y1>=968)
	y1=968;  /* 968 */
    
    if (y2<24)
      y2=24;
    else
      if (y2>968)
	y2=968;

    if (y1<y2) {
      for(y=y1+8+4; y<=y2; y+=3) {
	
	vga_waitretrace();


#ifdef ANIM
	animate();
#endif

#ifndef USE_SDL
	for(n=0; n<=delay_len; n++);
#endif

#ifdef SCORE
	killscore(nr,win_y,y);
	win_y=y;
	putscore(nr,win_y);      

	gl_setdisplaystart(0,y-8);

#endif

	
/*      
#ifdef SCORE
	putscoreOnly(nr,win_y);
#endif
*/
	
      }
      vga_waitretrace();
      
#ifndef USE_SDL
      delay_len=delay_len<<1;
      for(n=0; n<=delay_len; n++);
      delay_len=delay_len>>1;
#endif
 
#ifdef SCORE
      killscore(nr,win_y,y2);
      win_y=y2;
      putscore(nr,win_y);
#endif
      gl_setdisplaystart(0,y2-8);

    }
    else {
      for(y=y1+8-4; y>=y2; y-=3) {
	
        vga_waitretrace();
	

#ifdef ANIM
	animate();
#endif

#ifndef USE_SDL
	for(n=0; n<=delay_len; n++);
#endif

#ifdef SCORE
        killscore(nr,win_y,y);
        win_y=y;
        putscore(nr,win_y);
#endif
	gl_setdisplaystart(0,y-8);
 

/*	
#ifdef SCORE
       	putscoreOnly(nr,win_y);
#endif 
*/          
      }
      vga_waitretrace();
      gl_setdisplaystart(0,y2-8);

#ifndef USE_SDL
      delay_len=delay_len<<1;
      for(n=0; n<=delay_len; n++);
      delay_len=delay_len>>1;
#endif

#ifdef SCORE
      killscore(nr,win_y,y2);
      win_y=y2;
      putscore(nr,win_y);
#endif

    }
  }
}