~extremepopcorn/dhlib/dhlib_ep

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
package fortress;

import mathx.MatPoint;


class Global
{
	public var difficulty : Int;
	
//do member defintions first
define(`DInt', public var $1 : Int; )
define(`DFloat', public var $1 : Float; )
define(`DIPoint', public var $1 : MatPoint; )
include(`Global.ihx')

//then do constructor intialization
	public function new( difficulty : Int )
	{
		this.difficulty = difficulty;
		
define(`IDIFF', difficulty )
define(`FDIFF', difficulty )
define(`FSCALE', $1 * (1.0 + $2 * difficulty) )	//each level is $2 factor diff (0.1 => 10%)

//Math.max not used since it forces Float, these don't force a type
define(`MAX',  if( ($2) < ($1) ) ($1) else ($2) )	
define(`MIN',  if( ($2) < ($1) ) ($2) else ($1) )	

define(`DInt', $1 = $2; )
define(`DFloat', $1 = $2; )
define(`DIPoint', $1 = MatPoint.at( $2, $3 ); )
include(`Global.ihx')
	}
}