diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-01-07 16:40:33 -0500 |
|---|---|---|
| committer | Franklin Wei <franklin@fwei.ml> | 2015-06-13 19:44:59 -0400 |
| commit | b9fb85845715d81f50d8fd6bf523982b339d26e7 (patch) | |
| tree | 032516d8ef26dcb67beee3b6c5a8459ebee941eb /apps/plugins/xracer/xracer.h | |
| parent | 8aa72f07f4bf38e9b898fb8d8042239861b9a423 (diff) | |
| download | rockbox-xracer.zip rockbox-xracer.tar.gz rockbox-xracer.tar.bz2 rockbox-xracer.tar.xz | |
[WIP] XRacer - a racing gamexracer
Plan:
-----
A simple racing game like Pole Position or Enduro.
Status:
-------
- Currently generates a random road and scrolls through it
- Random road generation (curves and hills)
- Supports loading of maps from a file ("/output.xrm")
- Sample map at http://a.pomf.se/ynhlwq.xrm
Todo:
-----
- Convert to fixed-point math in all places (only one place left!)
- Improve/fix track looping
- Improve random road generation to start and end at the same height
- Finish sprite code
- Make sprites
- Game-ify!
What's new:
-----------
- NEW: uses greylib on low-depth targets!
- Loadable maps implemented, UNTESTED!
- Sprites in progress (see render() in graphics.c)
Change-Id: Ia2ff60b3c43d9f2e3a4f63e0ad90d2cb571c605e
Diffstat (limited to 'apps/plugins/xracer/xracer.h')
| -rw-r--r-- | apps/plugins/xracer/xracer.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/apps/plugins/xracer/xracer.h b/apps/plugins/xracer/xracer.h new file mode 100644 index 0000000..967f948 --- /dev/null +++ b/apps/plugins/xracer/xracer.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2015 Franklin Wei + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef _XRACER_H_ +#define _XRACER_H_ + +/* miscellaneous #defines and data types */ + +#include "plugin.h" + +/* colors */ +#define SKY_COLOR1 LCD_RGBPACK(0, 0x96, 0xff) /* top of sky gradient */ +#define SKY_COLOR2 LCD_RGBPACK(0xfe, 0xfe, 0xfe) /* bottom of sky gradient */ +#define GRASS_COLOR1 LCD_RGBPACK(0, 0xc5, 0) +#define GRASS_COLOR2 LCD_RGBPACK(0, 0x9a, 0) +#define ROAD_COLOR1 LCD_RGBPACK(120, 120, 120) +#define ROAD_COLOR2 LCD_RGBPACK(80, 80, 80) +#define BORDER_COLOR1 LCD_RGBPACK(240, 0, 0) +#define BORDER_COLOR2 LCD_RGBPACK(240, 240, 240) +#define LANE_COLOR LCD_RGBPACK(0xcc, 0xcc, 0xcc) + +/* road parameters */ +#define ROAD_WIDTH (LCD_WIDTH/2) /* actually half the road width for easier math */ +#define MAX_ROAD_LENGTH 4096 +#define SEGMENT_LENGTH (LCD_WIDTH * 12) + +/* road generator parameters */ +#define HILLS true +#define CURVES true + +/* this specifies the length of each road and border color in segments */ +#define RUMBLE_LENGTH 3 +#define LANES 3 + +/* camera parameters */ +#define DRAW_DIST 512 +#define CAMERA_FOV 120 /* in degrees */ +#define CAMERA_HEIGHT 100 + +/* game parameters */ +/* currently this is how far the camera moves per keypress */ +#define MANUAL_SPEED 50 + +/* number of bits to use for the fractional part of fixed-point numbers */ +/* note that FOV calculation always uses 14 by default */ +#define FRACBITS 8 + +/* the number of fractional bits to use for high-precision numbers */ +#define HIPREC_FRACBITS 24 + +#endif |