2007-02-16 01:23:48 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2009-07-12 15:04:56 +00:00
|
|
|
* $Id$
|
2007-02-16 06:57:49 +00:00
|
|
|
*
|
2007-02-16 01:23:48 +00:00
|
|
|
* Originally by Joshua Oreman, improved by Prashant Varanasi
|
|
|
|
* Ported to Rockbox by Ben Basha (Paprica)
|
2007-02-16 06:57:49 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2007-02-16 01:23:48 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/xlcd.h"
|
|
|
|
#include "lib/configfile.h"
|
|
|
|
#include "lib/helper.h"
|
2009-02-26 17:10:27 +00:00
|
|
|
#include "lib/playback_control.h"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-09-12 22:04:19 +00:00
|
|
|
/*
|
|
|
|
Still To do:
|
|
|
|
- Make original speed and further increases in speed depend more on screen size
|
|
|
|
- attempt to make the tunnels get narrower as the game goes on
|
|
|
|
- make the chopper look better, maybe a picture, and scale according
|
|
|
|
to screen size
|
|
|
|
- use textures for the color screens for background and terrain,
|
|
|
|
eg stars on background
|
|
|
|
- allow choice of different levels [later: different screen themes]
|
|
|
|
- better high score handling, improved screen etc.
|
|
|
|
*/
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
|
|
|
|
|
|
|
#define QUIT BUTTON_OFF
|
|
|
|
#define ACTION BUTTON_UP
|
|
|
|
#define ACTION2 BUTTON_SELECT
|
2007-02-16 07:21:47 +00:00
|
|
|
#define ACTIONTEXT "SELECT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
#define QUIT BUTTON_MENU
|
|
|
|
#define ACTION BUTTON_SELECT
|
2007-02-16 06:57:49 +00:00
|
|
|
#define ACTIONTEXT "SELECT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD /* grayscale at the moment */
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
#define QUIT BUTTON_POWER
|
2007-02-17 10:23:15 +00:00
|
|
|
#define ACTION BUTTON_UP
|
|
|
|
#define ACTION2 BUTTON_SELECT
|
2007-02-16 06:57:49 +00:00
|
|
|
#define ACTIONTEXT "SELECT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_RIGHT
|
2007-02-16 06:57:49 +00:00
|
|
|
#define ACTIONTEXT "RIGHT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
2009-01-04 23:33:15 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
2011-11-16 14:08:01 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CONNECT_PAD)
|
2007-02-16 01:23:48 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_SELECT
|
2007-02-16 06:57:49 +00:00
|
|
|
#define ACTIONTEXT "SELECT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
2010-01-26 21:35:09 +00:00
|
|
|
#define QUIT BUTTON_HOME
|
|
|
|
#define ACTION BUTTON_SELECT
|
|
|
|
#define ACTIONTEXT "SELECT"
|
2009-04-10 17:28:26 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
|
|
|
#define QUIT BUTTON_MENU
|
|
|
|
#define ACTION BUTTON_SELECT
|
2007-02-16 06:57:49 +00:00
|
|
|
#define ACTIONTEXT "SELECT"
|
2007-02-16 01:23:48 +00:00
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD \
|
|
|
|
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
2008-02-17 12:23:02 +00:00
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define ACTION BUTTON_SELECT
|
|
|
|
#define ACTION2 BUTTON_MENU
|
|
|
|
#define ACTIONTEXT "SELECT"
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE100_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_SELECT
|
|
|
|
#define ACTIONTEXT "SELECT"
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define QUIT BUTTON_RC_REC
|
|
|
|
#define ACTION BUTTON_RC_PLAY
|
|
|
|
#define ACTION2 BUTTON_RC_MODE
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
2010-02-24 20:33:40 +00:00
|
|
|
#define ACTION2 BUTTON_PLUS
|
2008-03-22 22:03:34 +00:00
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTION2 BUTTON_STOP
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define ACTION BUTTON_UP
|
|
|
|
#define ACTION2 BUTTON_MENU
|
|
|
|
#define ACTIONTEXT "UP"
|
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_UP
|
|
|
|
#define ACTION2 BUTTON_MENU
|
|
|
|
#define ACTIONTEXT "UP"
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_MENU
|
|
|
|
#define ACTION2 BUTTON_SELECT
|
|
|
|
#define ACTIONTEXT "MENU"
|
|
|
|
|
2010-11-02 03:29:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_MENU
|
|
|
|
#define ACTION2 BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "MENU"
|
|
|
|
|
2009-12-02 01:56:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_MENU
|
|
|
|
#define ACTION2 BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "MENU"
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD || \
|
|
|
|
CONFIG_KEYPAD == ONDAVX777_PAD || \
|
|
|
|
CONFIG_KEYPAD == MROBE500_PAD
|
2009-04-07 23:41:44 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2009-08-04 03:08:32 +00:00
|
|
|
#define QUIT BUTTON_LEFT
|
|
|
|
#define ACTION BUTTON_RIGHT
|
2015-07-19 23:50:26 +00:00
|
|
|
#define ACTION2 BUTTON_UP
|
|
|
|
#define ACTIONTEXT "RIGHT or UP"
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-13 15:46:34 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define QUIT BUTTON_REC
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTION2 BUTTON_UP
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
#define QUIT (BUTTON_REC|BUTTON_PLAY)
|
2010-11-02 10:44:34 +00:00
|
|
|
#define ACTION BUTTON_FUNC
|
|
|
|
#define ACTIONTEXT "FUNC"
|
2010-04-26 21:40:00 +00:00
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
2012-02-02 13:42:42 +00:00
|
|
|
#define QUIT (BUTTON_MENU|BUTTON_REPEAT)
|
2010-11-30 10:52:14 +00:00
|
|
|
#define ACTION BUTTON_ENTER
|
|
|
|
#define ACTIONTEXT "ENTER"
|
|
|
|
|
2011-10-02 16:05:20 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_SELECT
|
|
|
|
#define ACTIONTEXT "SELECT"
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == HM801_PAD)
|
2012-03-23 18:32:50 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_SELECT
|
|
|
|
#define ACTIONTEXT "SELECT"
|
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define ACTION BUTTON_SELECT
|
2018-03-02 20:53:55 +00:00
|
|
|
#define ACTIONTEXT "Select"
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_SELECT
|
2014-07-17 08:40:17 +00:00
|
|
|
#define ACTIONTEXT "Select"
|
|
|
|
|
2018-06-28 10:24:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
2018-06-29 20:09:28 +00:00
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2018-11-05 12:01:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3II_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X20_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
2018-06-29 20:09:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
|
|
|
#define ACTIONTEXT "PLAY"
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IHIFI_800_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define ACTION BUTTON_PLAY
|
2018-06-28 10:24:26 +00:00
|
|
|
#define ACTIONTEXT "PLAY"
|
2014-07-17 08:40:17 +00:00
|
|
|
|
2012-01-26 22:59:23 +00:00
|
|
|
#elif !defined(HAVE_TOUCHSCREEN)
|
2008-03-01 22:55:09 +00:00
|
|
|
#error No keymap defined!
|
2007-02-16 01:23:48 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef QUIT
|
|
|
|
#define QUIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef ACTION
|
|
|
|
#define ACTION BUTTON_BOTTOMLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef ACTION2
|
|
|
|
#define ACTION2 BUTTON_BOTTOMRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef ACTIONTEXT
|
|
|
|
#define ACTIONTEXT "BOTTOMRIGHT"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#define NUMBER_OF_BLOCKS 8
|
|
|
|
#define NUMBER_OF_PARTICLES 3
|
|
|
|
#define MAX_TERRAIN_NODES 15
|
|
|
|
|
|
|
|
#define LEVEL_MODE_NORMAL 0
|
|
|
|
#define LEVEL_MODE_STEEP 1
|
|
|
|
|
2009-04-07 17:02:39 +00:00
|
|
|
#if LCD_HEIGHT <= 64
|
2009-10-08 19:04:53 +00:00
|
|
|
#define CYCLES 100
|
2009-07-12 11:56:38 +00:00
|
|
|
static inline int SCALE(int x)
|
|
|
|
{
|
|
|
|
return x == 1 ? x : x >> 1;
|
|
|
|
}
|
2007-02-20 00:40:21 +00:00
|
|
|
#define SIZE 2
|
|
|
|
#else
|
2009-10-08 19:04:53 +00:00
|
|
|
#define CYCLES 60
|
2007-02-20 00:40:21 +00:00
|
|
|
#define SCALE(x) (x)
|
|
|
|
#define SIZE 1
|
|
|
|
#endif
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2009-10-08 19:04:53 +00:00
|
|
|
/* in 10 milisecond (ticks) */
|
|
|
|
#define CYCLETIME ((CYCLES*HZ)/1000)
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
/*Chopper's local variables to track the terrain position etc*/
|
|
|
|
static int chopCounter;
|
|
|
|
static int iRotorOffset;
|
|
|
|
static int iScreenX;
|
|
|
|
static int iScreenY;
|
|
|
|
static int iPlayerPosX;
|
|
|
|
static int iPlayerPosY;
|
|
|
|
static int iCameraPosX;
|
|
|
|
static int iPlayerSpeedX;
|
|
|
|
static int iPlayerSpeedY;
|
|
|
|
static int iLastBlockPlacedPosX;
|
|
|
|
static int iGravityTimerCountdown;
|
|
|
|
static int iPlayerAlive;
|
2010-02-12 12:11:37 +00:00
|
|
|
static int iLevelMode, iCurrLevelMode;
|
2007-02-16 01:23:48 +00:00
|
|
|
static int blockh,blockw;
|
|
|
|
static int highscore;
|
|
|
|
static int score;
|
|
|
|
|
|
|
|
#define CFG_FILE "chopper.cfg"
|
|
|
|
#define MAX_POINTS 50000
|
|
|
|
static struct configdata config[] =
|
|
|
|
{
|
2009-01-17 22:53:12 +00:00
|
|
|
{TYPE_INT, 0, MAX_POINTS, { .int_p = &highscore }, "highscore", NULL}
|
2007-02-16 01:23:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CBlock
|
|
|
|
{
|
|
|
|
int iWorldX;
|
|
|
|
int iWorldY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int iSizeX;
|
|
|
|
int iSizeY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int bIsActive;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CParticle
|
|
|
|
{
|
|
|
|
int iWorldX;
|
|
|
|
int iWorldY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int iSpeedX;
|
|
|
|
int iSpeedY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int bIsActive;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CTerrainNode
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CTerrain
|
|
|
|
{
|
|
|
|
struct CTerrainNode mNodes[MAX_TERRAIN_NODES];
|
|
|
|
int iNodesCount;
|
|
|
|
int iLastNodePlacedPosX;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CBlock mBlocks[NUMBER_OF_BLOCKS];
|
|
|
|
struct CParticle mParticles[NUMBER_OF_PARTICLES];
|
|
|
|
|
|
|
|
struct CTerrain mGround;
|
|
|
|
struct CTerrain mRoof;
|
|
|
|
|
|
|
|
/*Function declarations*/
|
|
|
|
static void chopDrawParticle(struct CParticle *mParticle);
|
|
|
|
static void chopDrawBlock(struct CBlock *mBlock);
|
2010-02-12 12:11:37 +00:00
|
|
|
static void chopRenderTerrain(struct CTerrain *ter, bool isground);
|
2011-10-15 20:38:08 +00:00
|
|
|
static void chopper_load(bool newgame);
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-09-12 22:04:19 +00:00
|
|
|
static void chopDrawPlayer(int x,int y) /* These are SCREEN coords, not world!*/
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
#if LCD_DEPTH > 2
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(50,50,200));
|
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_DARKGRAY);
|
|
|
|
#endif
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_fillrect(SCALE(x+6), SCALE(y+2), SCALE(12), SCALE(9));
|
|
|
|
rb->lcd_fillrect(SCALE(x-3), SCALE(y+6), SCALE(20), SCALE(3));
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(50,50,50));
|
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_DARKGRAY);
|
|
|
|
#endif
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_fillrect(SCALE(x+10), SCALE(y), SCALE(2), SCALE(3));
|
|
|
|
rb->lcd_fillrect(SCALE(x+10), SCALE(y), SCALE(1), SCALE(3));
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(40,40,100));
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
|
|
|
#endif
|
2007-09-12 22:04:19 +00:00
|
|
|
rb->lcd_drawline(SCALE(x), SCALE(y+iRotorOffset), SCALE(x+20),
|
|
|
|
SCALE(y-iRotorOffset));
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(20,20,50));
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
|
|
|
#endif
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_fillrect(SCALE(x - 2), SCALE(y + 5), SCALE(2), SCALE(5));
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2007-02-16 06:57:49 +00:00
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
static void chopClearTerrain(struct CTerrain *ter)
|
|
|
|
{
|
2007-02-18 14:21:04 +00:00
|
|
|
ter->iNodesCount = 0;
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int iR(int low,int high)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
return low+rb->rand()%(high-low+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopCopyTerrain(struct CTerrain *src, struct CTerrain *dest,
|
|
|
|
int xOffset,int yOffset)
|
|
|
|
{
|
|
|
|
int i=0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while(i < src->iNodesCount)
|
|
|
|
{
|
|
|
|
dest->mNodes[i].x = src->mNodes[i].x + xOffset;
|
|
|
|
dest->mNodes[i].y = src->mNodes[i].y + yOffset;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
i++;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
dest->iNodesCount = src->iNodesCount;
|
|
|
|
dest->iLastNodePlacedPosX = src->iLastNodePlacedPosX;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopAddTerrainNode(struct CTerrain *ter, int x, int y)
|
|
|
|
{
|
|
|
|
int i=0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(ter->iNodesCount + 1 >= MAX_TERRAIN_NODES)
|
|
|
|
{
|
|
|
|
/* DEBUGF("ERROR: Not enough nodes!\n"); */
|
|
|
|
return;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
ter->iNodesCount++;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
i = ter->iNodesCount - 1;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
ter->mNodes[i].x = x;
|
|
|
|
ter->mNodes[i].y= y;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
ter->iLastNodePlacedPosX = x;
|
|
|
|
|
2007-02-16 06:57:49 +00:00
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
static void chopTerrainNodeDeleteAndShift(struct CTerrain *ter,int nodeIndex)
|
|
|
|
{
|
|
|
|
int i=nodeIndex;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while( i < ter->iNodesCount )
|
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
ter->mNodes[i - 1] = ter->mNodes[i];
|
2007-02-16 01:23:48 +00:00
|
|
|
i++;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
ter->iNodesCount--;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int chopUpdateTerrainRecycling(struct CTerrain *ter)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
int i=1;
|
|
|
|
int iNewNodePos,g,v;
|
|
|
|
while(i < ter->iNodesCount)
|
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if( iCameraPosX > ter->mNodes[i].x)
|
|
|
|
{
|
|
|
|
|
|
|
|
chopTerrainNodeDeleteAndShift(ter,i);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iNewNodePos = ter->iLastNodePlacedPosX + 50;
|
|
|
|
g = iScreenY - 10;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
v = 3*iPlayerSpeedX;
|
2007-02-16 06:57:49 +00:00
|
|
|
if(v>50)
|
2007-02-16 01:23:48 +00:00
|
|
|
v=50;
|
2010-02-12 12:11:37 +00:00
|
|
|
if(iCurrLevelMode == LEVEL_MODE_STEEP)
|
2007-02-16 01:23:48 +00:00
|
|
|
v*=5;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
chopAddTerrainNode(ter,iNewNodePos,g - iR(-v,v));
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int chopTerrainHeightAtPoint(struct CTerrain *ter, int pX)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2011-05-01 13:48:28 +00:00
|
|
|
int iNodeIndexOne=0,iNodeIndexTwo=0, h, terY1, terY2, terX2, a, b;
|
2007-02-16 01:23:48 +00:00
|
|
|
float c,d;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int i=0;
|
|
|
|
for(i=1;i<MAX_TERRAIN_NODES;i++)
|
|
|
|
{
|
|
|
|
if(ter->mNodes[i].x > pX)
|
|
|
|
{
|
|
|
|
iNodeIndexOne = i - 1;
|
|
|
|
break;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iNodeIndexTwo = iNodeIndexOne + 1;
|
|
|
|
terY1 = ter->mNodes[iNodeIndexOne].y;
|
|
|
|
terY2 = ter->mNodes[iNodeIndexTwo].y;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2011-05-01 13:48:28 +00:00
|
|
|
/* terX1 = 0; */
|
2007-02-16 01:23:48 +00:00
|
|
|
terX2 = ter->mNodes[iNodeIndexTwo].x - ter->mNodes[iNodeIndexOne].x;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
pX-= ter->mNodes[iNodeIndexOne].x;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
a = terY2 - terY1;
|
|
|
|
b = terX2;
|
|
|
|
c = pX;
|
|
|
|
d = (c/b) * a;
|
|
|
|
|
|
|
|
h = d + terY1;
|
|
|
|
|
|
|
|
return h;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int chopPointInTerrain(struct CTerrain *ter, int pX, int pY, int iTestType)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
int h = chopTerrainHeightAtPoint(ter, pX);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(iTestType == 0)
|
|
|
|
return (pY > h);
|
|
|
|
else
|
|
|
|
return (pY < h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopAddBlock(int x,int y,int sx,int sy, int indexOverride)
|
|
|
|
{
|
|
|
|
int i=0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(indexOverride < 0)
|
|
|
|
{
|
|
|
|
while(mBlocks[i].bIsActive && i < NUMBER_OF_BLOCKS)
|
2007-02-16 06:57:49 +00:00
|
|
|
i++;
|
2007-02-16 01:23:48 +00:00
|
|
|
if(i==NUMBER_OF_BLOCKS)
|
|
|
|
{
|
|
|
|
DEBUGF("No blocks!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
i = indexOverride;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
mBlocks[i].bIsActive = 1;
|
|
|
|
mBlocks[i].iWorldX = x;
|
|
|
|
mBlocks[i].iWorldY = y;
|
|
|
|
mBlocks[i].iSizeX = sx;
|
|
|
|
mBlocks[i].iSizeY = sy;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iLastBlockPlacedPosX = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopAddParticle(int x,int y,int sx,int sy)
|
|
|
|
{
|
|
|
|
int i=0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while(mParticles[i].bIsActive && i < NUMBER_OF_PARTICLES)
|
|
|
|
i++;
|
|
|
|
|
2007-02-18 14:21:04 +00:00
|
|
|
if(i==NUMBER_OF_PARTICLES)
|
2007-02-16 01:23:48 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
mParticles[i].bIsActive = 1;
|
|
|
|
mParticles[i].iWorldX = x;
|
|
|
|
mParticles[i].iWorldY = y;
|
|
|
|
mParticles[i].iSpeedX = sx;
|
|
|
|
mParticles[i].iSpeedY = sy;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopGenerateBlockIfNeeded(void)
|
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
int DistSpeedX = iPlayerSpeedX * 5;
|
|
|
|
if(DistSpeedX<200) DistSpeedX = 200;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while(i < NUMBER_OF_BLOCKS)
|
|
|
|
{
|
|
|
|
if(!mBlocks[i].bIsActive)
|
|
|
|
{
|
|
|
|
int iX,iY,sX,sY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iX = iLastBlockPlacedPosX + (350-DistSpeedX);
|
|
|
|
sX = blockw;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iY = iR(0,iScreenY);
|
|
|
|
sY = blockh + iR(1,blockh/3);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
chopAddBlock(iX,iY,sX,sY,i);
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
i++;
|
2007-02-16 06:57:49 +00:00
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int chopBlockCollideWithPlayer(struct CBlock *mBlock)
|
|
|
|
{
|
|
|
|
int px = iPlayerPosX;
|
|
|
|
int py = iPlayerPosY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int x = mBlock->iWorldX-17;
|
|
|
|
int y = mBlock->iWorldY-11;
|
|
|
|
|
|
|
|
int x2 = x + mBlock->iSizeX+17;
|
|
|
|
int y2 = y + mBlock->iSizeY+11;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(px>x && px<x2)
|
|
|
|
{
|
|
|
|
if(py>y && py<y2)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
|
|
|
return 0;
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int chopBlockOffscreen(struct CBlock *mBlock)
|
|
|
|
{
|
|
|
|
if(mBlock->iWorldX + mBlock->iSizeX < iCameraPosX)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int chopParticleOffscreen(struct CParticle *mParticle)
|
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
if (mParticle->iWorldX < iCameraPosX || mParticle->iWorldY < 0 ||
|
|
|
|
mParticle->iWorldY > iScreenY || mParticle->iWorldX > iCameraPosX +
|
2007-02-16 01:23:48 +00:00
|
|
|
iScreenX)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopKillPlayer(void)
|
|
|
|
{
|
2010-02-12 12:11:37 +00:00
|
|
|
int i;
|
2007-02-16 07:12:06 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
for (i = 0; i < NUMBER_OF_PARTICLES; i++) {
|
|
|
|
mParticles[i].bIsActive = 0;
|
2007-02-16 06:57:49 +00:00
|
|
|
chopAddParticle(iPlayerPosX + iR(0,20), iPlayerPosY + iR(0,20),
|
2007-02-16 01:23:48 +00:00
|
|
|
iR(-2,2), iR(-2,2));
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iPlayerAlive--;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if (iPlayerAlive == 0) {
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ, "Game Over");
|
2007-02-17 10:23:15 +00:00
|
|
|
|
|
|
|
if (score > highscore) {
|
|
|
|
char scoretext[30];
|
|
|
|
highscore = score;
|
|
|
|
rb->snprintf(scoretext, sizeof(scoretext), "New High Score: %d",
|
|
|
|
highscore);
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ*2, scoretext);
|
2007-02-17 10:23:15 +00:00
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
} else
|
2007-02-16 01:23:48 +00:00
|
|
|
chopper_load(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopDrawTheWorld(void)
|
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
int i=0;
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while(i < NUMBER_OF_BLOCKS)
|
|
|
|
{
|
|
|
|
if(mBlocks[i].bIsActive)
|
|
|
|
{
|
|
|
|
if(chopBlockOffscreen(&mBlocks[i]) == 1)
|
|
|
|
mBlocks[i].bIsActive = 0;
|
|
|
|
else
|
|
|
|
chopDrawBlock(&mBlocks[i]);
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
i=0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while(i < NUMBER_OF_PARTICLES)
|
|
|
|
{
|
|
|
|
if(mParticles[i].bIsActive)
|
|
|
|
{
|
|
|
|
if(chopParticleOffscreen(&mParticles[i]) == 1)
|
|
|
|
mParticles[i].bIsActive = 0;
|
|
|
|
else
|
|
|
|
chopDrawParticle(&mParticles[i]);
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
i++;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
chopRenderTerrain(&mGround, true);
|
|
|
|
chopRenderTerrain(&mRoof, false);
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopDrawParticle(struct CParticle *mParticle)
|
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int iPosX = (mParticle->iWorldX - iCameraPosX);
|
|
|
|
int iPosY = (mParticle->iWorldY);
|
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(192,192,192));
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_LIGHTGRAY);
|
|
|
|
#endif
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_fillrect(SCALE(iPosX), SCALE(iPosY), SCALE(3), SCALE(3));
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopDrawScene(void)
|
|
|
|
{
|
|
|
|
char s[30];
|
2007-07-25 10:21:54 +00:00
|
|
|
int w;
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_background(LCD_WHITE);
|
|
|
|
#endif
|
2010-02-12 12:11:37 +00:00
|
|
|
rb->lcd_clear_display();
|
2007-02-16 01:23:48 +00:00
|
|
|
chopDrawTheWorld();
|
|
|
|
chopDrawPlayer(iPlayerPosX - iCameraPosX, iPlayerPosY);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
score = -20 + iPlayerPosX/3;
|
2007-02-20 00:40:21 +00:00
|
|
|
|
|
|
|
#if LCD_DEPTH == 1
|
|
|
|
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
|
|
|
|
#else
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2007-02-20 00:40:21 +00:00
|
|
|
#endif
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
|
|
|
#endif
|
2007-07-25 08:30:40 +00:00
|
|
|
|
2007-07-25 10:21:54 +00:00
|
|
|
#if LCD_WIDTH <= 128
|
|
|
|
rb->snprintf(s, sizeof(s), "Dist: %d", score);
|
|
|
|
#else
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "Distance: %d", score);
|
2007-07-25 10:21:54 +00:00
|
|
|
#endif
|
|
|
|
rb->lcd_getstringsize(s, &w, NULL);
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->lcd_putsxy(2, 2, s);
|
2007-07-25 10:21:54 +00:00
|
|
|
if (score < highscore)
|
|
|
|
{
|
|
|
|
int w2;
|
|
|
|
#if LCD_WIDTH <= 128
|
|
|
|
rb->snprintf(s, sizeof(s), "Hi: %d", highscore);
|
|
|
|
#else
|
|
|
|
rb->snprintf(s, sizeof(s), "Best: %d", highscore);
|
|
|
|
#endif
|
|
|
|
rb->lcd_getstringsize(s, &w2, NULL);
|
|
|
|
if (LCD_WIDTH - 2 - w2 > w + 2)
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH - 2 - w2, 2, s);
|
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
|
2009-06-26 17:59:33 +00:00
|
|
|
static bool _ingame;
|
2020-07-19 17:42:04 +00:00
|
|
|
static int chopMenuCb(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2009-06-26 17:59:33 +00:00
|
|
|
{
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2009-06-26 17:59:33 +00:00
|
|
|
if(action == ACTION_REQUEST_MENUITEM
|
|
|
|
&& !_ingame && ((intptr_t)this_item)==0)
|
|
|
|
return ACTION_EXIT_MENUITEM;
|
|
|
|
return action;
|
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
static int chopMenu(int menunum)
|
|
|
|
{
|
2009-06-26 17:59:33 +00:00
|
|
|
int result = 0;
|
2007-02-16 01:23:48 +00:00
|
|
|
int res = 0;
|
|
|
|
bool menu_quit = false;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
static const struct opt_items levels[2] = {
|
|
|
|
{ "Normal", -1 },
|
|
|
|
{ "Steep", -1 },
|
|
|
|
};
|
2007-04-03 20:22:04 +00:00
|
|
|
|
2009-06-26 17:59:33 +00:00
|
|
|
MENUITEM_STRINGLIST(menu,"Chopper Menu",chopMenuCb,
|
|
|
|
"Resume Game","Start New Game",
|
2009-02-26 17:10:27 +00:00
|
|
|
"Level","Playback Control","Quit");
|
2009-06-26 17:59:33 +00:00
|
|
|
_ingame = (menunum!=0);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-17 23:06:22 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
2007-02-17 10:23:15 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
|
|
|
rb->lcd_set_background(LCD_WHITE);
|
2007-02-16 06:57:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
rb->lcd_clear_display();
|
2010-02-12 12:11:37 +00:00
|
|
|
rb->button_clear_queue();
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while (!menu_quit) {
|
2008-03-26 03:35:24 +00:00
|
|
|
switch(rb->do_menu(&menu, &result, NULL, false))
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
2009-06-26 17:59:33 +00:00
|
|
|
case 0: /* Resume Game */
|
2007-02-16 01:23:48 +00:00
|
|
|
menu_quit=true;
|
|
|
|
res = -1;
|
|
|
|
break;
|
2009-06-26 17:59:33 +00:00
|
|
|
case 1: /* Start New Game */
|
|
|
|
menu_quit=true;
|
|
|
|
chopper_load(true);
|
|
|
|
res = -1;
|
2007-02-16 01:23:48 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
rb->set_option("Level", &iLevelMode, INT, levels, 2, NULL);
|
|
|
|
break;
|
|
|
|
case 3:
|
2009-02-26 17:10:27 +00:00
|
|
|
playback_control(NULL);
|
|
|
|
break;
|
|
|
|
case 4:
|
2007-02-16 01:23:48 +00:00
|
|
|
menu_quit=true;
|
|
|
|
res = PLUGIN_OK;
|
|
|
|
break;
|
|
|
|
case MENU_ATTACHED_USB:
|
|
|
|
menu_quit=true;
|
|
|
|
res = PLUGIN_USB_CONNECTED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int chopGameLoop(void)
|
|
|
|
{
|
|
|
|
int move_button, ret;
|
|
|
|
bool exit=false;
|
2015-04-10 22:27:44 +00:00
|
|
|
bool showsplash=true;
|
2007-02-16 01:23:48 +00:00
|
|
|
int end, i=0, bdelay=0, last_button=BUTTON_NONE;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if (chopUpdateTerrainRecycling(&mGround) == 1)
|
|
|
|
/* mirror the sky if we've changed the ground */
|
2007-02-20 00:40:21 +00:00
|
|
|
chopCopyTerrain(&mGround, &mRoof, 0, - ( (iScreenY * 3) / 4));
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
ret = chopMenu(0);
|
|
|
|
if (ret != -1)
|
|
|
|
return PLUGIN_OK;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
while (!exit) {
|
|
|
|
|
2009-10-08 19:04:53 +00:00
|
|
|
end = *rb->current_tick + CYCLETIME;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(chopUpdateTerrainRecycling(&mGround) == 1)
|
|
|
|
/* mirror the sky if we've changed the ground */
|
2007-02-20 00:40:21 +00:00
|
|
|
chopCopyTerrain(&mGround, &mRoof, 0, - ( (iScreenY * 3) / 4));
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iRotorOffset = iR(-1,1);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
/* We need to have this here so particles move when we're dead */
|
|
|
|
|
|
|
|
for (i=0; i < NUMBER_OF_PARTICLES; i++)
|
|
|
|
if(mParticles[i].bIsActive == 1)
|
|
|
|
{
|
|
|
|
mParticles[i].iWorldX += mParticles[i].iSpeedX;
|
|
|
|
mParticles[i].iWorldY += mParticles[i].iSpeedY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Redraw the main window: */
|
2007-02-16 06:57:49 +00:00
|
|
|
chopDrawScene();
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
iGravityTimerCountdown--;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if(iGravityTimerCountdown <= 0)
|
|
|
|
{
|
|
|
|
iGravityTimerCountdown = 3;
|
|
|
|
chopAddParticle(iPlayerPosX, iPlayerPosY+5, 0, 0);
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
if(iCurrLevelMode == LEVEL_MODE_NORMAL)
|
2007-02-16 01:23:48 +00:00
|
|
|
chopGenerateBlockIfNeeded();
|
|
|
|
|
2015-04-10 22:27:44 +00:00
|
|
|
if (showsplash) {
|
|
|
|
chopDrawScene();
|
|
|
|
rb->splash(HZ, "Get Ready!");
|
|
|
|
showsplash = false;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
move_button=rb->button_status();
|
|
|
|
if (rb->button_get(false) == QUIT) {
|
|
|
|
ret = chopMenu(1);
|
|
|
|
if (ret != -1)
|
|
|
|
return PLUGIN_OK;
|
2015-04-10 22:27:44 +00:00
|
|
|
showsplash = true;
|
2007-02-16 01:23:48 +00:00
|
|
|
bdelay = 0;
|
|
|
|
last_button = BUTTON_NONE;
|
|
|
|
move_button = BUTTON_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (move_button) {
|
|
|
|
case ACTION:
|
|
|
|
#ifdef ACTION2
|
|
|
|
case ACTION2:
|
|
|
|
#endif
|
|
|
|
if (last_button != ACTION
|
|
|
|
#ifdef ACTION2
|
|
|
|
&& last_button != ACTION2
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
bdelay = -2;
|
|
|
|
if (bdelay == 0)
|
|
|
|
iPlayerSpeedY = -3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (last_button == ACTION
|
|
|
|
#ifdef ACTION2
|
|
|
|
|| last_button == ACTION2
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
bdelay = 3;
|
|
|
|
if (bdelay == 0)
|
|
|
|
iPlayerSpeedY = 4;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if (rb->default_event_handler(move_button) == SYS_USB_CONNECTED)
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
last_button = move_button;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if (bdelay < 0) {
|
|
|
|
iPlayerSpeedY = bdelay;
|
|
|
|
bdelay++;
|
|
|
|
} else if (bdelay > 0) {
|
|
|
|
iPlayerSpeedY = bdelay;
|
|
|
|
bdelay--;
|
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
iCameraPosX = iPlayerPosX - 25;
|
|
|
|
iPlayerPosX += iPlayerSpeedX;
|
|
|
|
iPlayerPosY += iPlayerSpeedY;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
chopCounter++;
|
|
|
|
/* increase speed as we go along */
|
|
|
|
if (chopCounter == 100){
|
|
|
|
iPlayerSpeedX++;
|
|
|
|
chopCounter=0;
|
|
|
|
}
|
|
|
|
|
2007-02-16 06:57:49 +00:00
|
|
|
if (iPlayerPosY > iScreenY-10 || iPlayerPosY < -5 ||
|
|
|
|
chopPointInTerrain(&mGround, iPlayerPosX, iPlayerPosY + 10, 0) ||
|
2007-02-16 01:23:48 +00:00
|
|
|
chopPointInTerrain(&mRoof, iPlayerPosX ,iPlayerPosY, 1))
|
|
|
|
{
|
|
|
|
chopKillPlayer();
|
|
|
|
chopDrawScene();
|
|
|
|
ret = chopMenu(0);
|
|
|
|
if (ret != -1)
|
|
|
|
return ret;
|
2015-04-10 22:27:44 +00:00
|
|
|
showsplash = true;
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
for (i=0; i < NUMBER_OF_BLOCKS; i++)
|
|
|
|
if(mBlocks[i].bIsActive == 1)
|
|
|
|
if(chopBlockCollideWithPlayer(&mBlocks[i])) {
|
|
|
|
chopKillPlayer();
|
|
|
|
chopDrawScene();
|
|
|
|
ret = chopMenu(0);
|
|
|
|
if (ret != -1)
|
|
|
|
return ret;
|
2015-04-10 22:27:44 +00:00
|
|
|
showsplash = true;
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
2009-10-08 19:04:53 +00:00
|
|
|
if (TIME_BEFORE(*rb->current_tick, end))
|
|
|
|
rb->sleep(end - *rb->current_tick); /* wait until time is over */
|
2007-02-16 01:23:48 +00:00
|
|
|
else
|
|
|
|
rb->yield();
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chopDrawBlock(struct CBlock *mBlock)
|
2007-02-16 06:57:49 +00:00
|
|
|
{
|
2007-02-16 01:23:48 +00:00
|
|
|
int iPosX = (mBlock->iWorldX - iCameraPosX);
|
|
|
|
int iPosY = (mBlock->iWorldY);
|
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(100,255,100));
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
|
|
|
#endif
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_fillrect(SCALE(iPosX), SCALE(iPosY), SCALE(mBlock->iSizeX),
|
|
|
|
SCALE(mBlock->iSizeY));
|
2007-02-16 01:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
static void chopRenderTerrain(struct CTerrain *ter, bool isground)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
int i = 1;
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
int oldx = 0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-20 00:40:21 +00:00
|
|
|
while(i < ter->iNodesCount && oldx < iScreenX)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int x = ter->mNodes[i-1].x - iCameraPosX;
|
|
|
|
int y = ter->mNodes[i-1].y;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int x2 = ter->mNodes[i].x - iCameraPosX;
|
|
|
|
int y2 = ter->mNodes[i].y;
|
2010-02-12 12:11:37 +00:00
|
|
|
|
|
|
|
int ax, ay;
|
|
|
|
|
|
|
|
if ((y < y2) != isground)
|
|
|
|
{
|
|
|
|
ax = x2;
|
|
|
|
ay = y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ax = x;
|
|
|
|
ay = y2;
|
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
#if LCD_DEPTH > 2
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(100,255,100));
|
2007-02-16 01:23:48 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
|
|
|
rb->lcd_set_foreground(LCD_DARKGRAY);
|
|
|
|
#endif
|
|
|
|
|
2007-02-20 00:40:21 +00:00
|
|
|
rb->lcd_drawline(SCALE(x), SCALE(y), SCALE(x2), SCALE(y2));
|
|
|
|
|
2007-09-12 22:04:19 +00:00
|
|
|
xlcd_filltriangle(SCALE(x), SCALE(y), SCALE(x2), SCALE(y2),
|
2010-02-12 12:11:37 +00:00
|
|
|
SCALE(ax), SCALE(ay));
|
2007-02-20 00:40:21 +00:00
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
if (isground)
|
|
|
|
{
|
|
|
|
y = ay;
|
|
|
|
y2 = (LCD_HEIGHT*SIZE);
|
|
|
|
}
|
2007-02-16 01:23:48 +00:00
|
|
|
else
|
2010-02-12 12:11:37 +00:00
|
|
|
{
|
|
|
|
y = 0;
|
|
|
|
y2 = ay;
|
|
|
|
}
|
|
|
|
if (y2-y > 0)
|
|
|
|
rb->lcd_fillrect(SCALE(x), SCALE(y), SCALE(x2-x)+1, SCALE(y2-y)+1);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
oldx = x;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void chopper_load(bool newgame)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
int i;
|
|
|
|
int g;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
if (newgame) {
|
2007-02-20 00:40:21 +00:00
|
|
|
iScreenX = LCD_WIDTH * SIZE;
|
|
|
|
iScreenY = LCD_HEIGHT * SIZE;
|
|
|
|
blockh = iScreenY / 5;
|
|
|
|
blockw = iScreenX / 20;
|
2007-02-16 01:23:48 +00:00
|
|
|
iPlayerAlive = 1;
|
2010-02-12 12:11:37 +00:00
|
|
|
iCurrLevelMode = iLevelMode;
|
2007-02-16 01:23:48 +00:00
|
|
|
score = 0;
|
|
|
|
}
|
|
|
|
iRotorOffset = 0;
|
|
|
|
iPlayerPosX = 60;
|
2007-02-20 00:40:21 +00:00
|
|
|
iPlayerPosY = (iScreenY * 4) / 10;
|
2007-02-16 01:23:48 +00:00
|
|
|
iLastBlockPlacedPosX = 0;
|
|
|
|
iGravityTimerCountdown = 2;
|
|
|
|
chopCounter = 0;
|
|
|
|
iPlayerSpeedX = 3;
|
|
|
|
iPlayerSpeedY = 0;
|
2007-02-16 06:57:49 +00:00
|
|
|
iCameraPosX = 30;
|
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
for (i=0; i < NUMBER_OF_PARTICLES; i++)
|
|
|
|
mParticles[i].bIsActive = 0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
for (i=0; i < NUMBER_OF_BLOCKS; i++)
|
|
|
|
mBlocks[i].bIsActive = 0;
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
g = iScreenY - 10;
|
|
|
|
chopClearTerrain(&mGround);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
for (i=0; i < MAX_TERRAIN_NODES; i++)
|
|
|
|
chopAddTerrainNode(&mGround,i * 30,g - iR(0,20));
|
|
|
|
|
|
|
|
if (chopUpdateTerrainRecycling(&mGround) == 1)
|
|
|
|
/* mirror the sky if we've changed the ground */
|
2007-02-20 00:40:21 +00:00
|
|
|
chopCopyTerrain(&mGround, &mRoof, 0, - ( (iScreenY * 3) / 4));
|
2007-02-16 01:23:48 +00:00
|
|
|
|
2010-02-12 12:11:37 +00:00
|
|
|
if (iCurrLevelMode == LEVEL_MODE_NORMAL)
|
2007-02-16 01:23:48 +00:00
|
|
|
/* make it a bit more exciting, cause it's easy terrain... */
|
|
|
|
iPlayerSpeedX *= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this is the plugin entry point */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2007-02-16 01:23:48 +00:00
|
|
|
{
|
|
|
|
(void)parameter;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2007-02-16 06:57:49 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
rb->lcd_set_backdrop(NULL);
|
|
|
|
#endif
|
2007-02-17 23:06:22 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-02-16 06:57:49 +00:00
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
|
|
|
#endif
|
|
|
|
|
2020-07-24 22:14:32 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn off backlight timeout */
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2020-07-24 22:14:32 +00:00
|
|
|
#endif
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
rb->srand( *rb->current_tick );
|
|
|
|
|
|
|
|
configfile_load(CFG_FILE, config, 1, 0);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
chopper_load(true);
|
|
|
|
ret = chopGameLoop();
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
configfile_save(CFG_FILE, config, 1, 0);
|
2007-02-16 06:57:49 +00:00
|
|
|
|
2007-02-16 01:23:48 +00:00
|
|
|
rb->lcd_setfont(FONT_UI);
|
2020-07-24 22:14:32 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn on backlight timeout (revert to settings) */
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_use_settings();
|
2020-07-24 22:14:32 +00:00
|
|
|
#endif
|
2007-02-16 01:23:48 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|