Version 1.1
12
README.md
@ -1,5 +1,5 @@
|
|||||||
# ledHeadWii
|
# ledHeadWii
|
||||||
Porting on Wii of Peter Hirschberg's LedHEAD (classic electronic LED handled game simulator)
|
Based on Peter Hirschberg's LedHEAD (classic electronic LED handled game simulator) source code.
|
||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
LEDhead is a program that simulates the classic electronic LED (light emitting diode) based handheld
|
LEDhead is a program that simulates the classic electronic LED (light emitting diode) based handheld
|
||||||
@ -8,4 +8,12 @@ All games feature fully authentic sound-effects, and faithfully replicate the ga
|
|||||||
|
|
||||||
Rather than using proprietary code or "ROM images", as is the case with emulators, LEDhead uses simple
|
Rather than using proprietary code or "ROM images", as is the case with emulators, LEDhead uses simple
|
||||||
but extremely clever imitation to ensure excruciating faithfulness to the games you grew up with.
|
but extremely clever imitation to ensure excruciating faithfulness to the games you grew up with.
|
||||||
Endless hours of painstaking effort have gone into ensuring the accuracy of each of these games.
|
Endless hours of painstaking effort have gone into ensuring the accuracy of each of these games.
|
||||||
|
|
||||||
|
## NOTE
|
||||||
|
Wii version have some games not present in original version. These games was developed from scratch.
|
||||||
|
|
||||||
|
## CREDITS
|
||||||
|
Thanks to Peter Hirschberg for the original source code.
|
||||||
|
Thanks to ArcadeUSA and Rick.R for playing real hardware games and telling me how they work.
|
||||||
|
And then for playing with the simulator to find the differences.
|
||||||
|
Before Width: | Height: | Size: 958 B |
Before Width: | Height: | Size: 852 B |
Before Width: | Height: | Size: 853 B |
Before Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 207 B |
BIN
data/images/autorace_slide.png
Normal file
After Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 188 B |
BIN
data/images/basketball2_screen.png
Normal file
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 391 B |
Before Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 284 B |
BIN
data/images/missileattack_screen.png
Normal file
After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1014 B |
Before Width: | Height: | Size: 1014 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 217 B |
BIN
data/images/skislalom_slide.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
data/images/skislalom_slide2.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
data/images/slide1.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
data/images/slide2.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
data/images/slide3.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
data/images/soccer2_screen.png
Normal file
After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 387 B |
Before Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 208 B |
BIN
data/images/switch1.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
data/images/switch2.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
data/images/switch3.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
data/images/switch4.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
data/sounds/basketball2_3secs.raw
Normal file
BIN
data/sounds/basketball2_bounce.raw
Normal file
BIN
data/sounds/basketball2_endgame.raw
Normal file
BIN
data/sounds/basketball2_endplay.raw
Normal file
BIN
data/sounds/basketball2_endquarter.raw
Normal file
BIN
data/sounds/basketball2_foul.raw
Normal file
BIN
data/sounds/basketball2_freethrow.raw
Normal file
BIN
data/sounds/basketball2_overtime.raw
Normal file
BIN
data/sounds/basketball2_score.raw
Normal file
BIN
data/sounds/basketball2_score3.raw
Normal file
1
data/sounds/basketball2_tick.raw
Normal file
@ -0,0 +1 @@
|
|||||||
|
όόϋώφφγ6λ…tδΊ &ζΌ<CEB6>'λΧ5ήΫ3τΟ<CF84>&εξ βυώμθττ&φυχϊσυ<CF83>ψω
|
BIN
data/sounds/soccer2_ballout.raw
Normal file
BIN
data/sounds/soccer2_beep.raw
Normal file
BIN
data/sounds/soccer2_bounce.raw
Normal file
BIN
data/sounds/soccer2_endgame.raw
Normal file
BIN
data/sounds/soccer2_endhalf.raw
Normal file
BIN
data/sounds/soccer2_goal.raw
Normal file
BIN
data/sounds/soccer2_highkick.raw
Normal file
BIN
data/sounds/soccer2_looseball.raw
Normal file
BIN
data/sounds/soccer2_lowkick.raw
Normal file
BIN
data/sounds/soccer2_tick.raw
Normal file
BIN
data/wiimote/WKBLR1.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
data/wiimote/WKD.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
data/wiimote/WKL.png
Normal file
After Width: | Height: | Size: 575 B |
BIN
data/wiimote/WKR.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
data/wiimote/WKU.png
Normal file
After Width: | Height: | Size: 594 B |
175
source/Games.c
@ -39,11 +39,13 @@ Website : http://www.peterhirschberg.com
|
|||||||
#include "autorace.h"
|
#include "autorace.h"
|
||||||
#include "spacealert.h"
|
#include "spacealert.h"
|
||||||
#include "basketball.h"
|
#include "basketball.h"
|
||||||
|
#include "basketball2.h"
|
||||||
#include "football.h"
|
#include "football.h"
|
||||||
#include "football2.h"
|
#include "football2.h"
|
||||||
#include "hockey.h"
|
#include "hockey.h"
|
||||||
#include "hockeyca.h"
|
#include "hockeyca.h"
|
||||||
#include "soccer.h"
|
#include "soccer.h"
|
||||||
|
#include "soccer2.h"
|
||||||
#include "armorbattle.h"
|
#include "armorbattle.h"
|
||||||
#include "baseball.h"
|
#include "baseball.h"
|
||||||
#include "subchase.h"
|
#include "subchase.h"
|
||||||
@ -51,15 +53,19 @@ Website : http://www.peterhirschberg.com
|
|||||||
#include "autorace_screen_png.h"
|
#include "autorace_screen_png.h"
|
||||||
#include "baseball_screen_png.h"
|
#include "baseball_screen_png.h"
|
||||||
#include "basketball_screen_png.h"
|
#include "basketball_screen_png.h"
|
||||||
|
#include "basketball2_screen_png.h"
|
||||||
#include "football_screen_png.h"
|
#include "football_screen_png.h"
|
||||||
#include "football2_screen_png.h"
|
#include "football2_screen_png.h"
|
||||||
#include "hockey_screen_png.h"
|
#include "hockey_screen_png.h"
|
||||||
#include "hockeyca_screen_png.h"
|
#include "hockeyca_screen_png.h"
|
||||||
#include "skislalom_screen_png.h"
|
#include "skislalom_screen_png.h"
|
||||||
#include "soccer_screen_png.h"
|
#include "soccer_screen_png.h"
|
||||||
|
#include "soccer2_screen_png.h"
|
||||||
#include "spacealert_screen_png.h"
|
#include "spacealert_screen_png.h"
|
||||||
|
#include "missileattack_screen_png.h"
|
||||||
#include "subchase_screen_png.h"
|
#include "subchase_screen_png.h"
|
||||||
#include "nodisp_screen_png.h"
|
|
||||||
|
//#define DEEP_DEBUG 1
|
||||||
|
|
||||||
GAMECONTEXT gGameContext[NUM_GAMES] =
|
GAMECONTEXT gGameContext[NUM_GAMES] =
|
||||||
{
|
{
|
||||||
@ -67,8 +73,7 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
{
|
{
|
||||||
GAME_ARMORBATTLE,
|
GAME_ARMORBATTLE,
|
||||||
150,
|
150,
|
||||||
"Armor Battle",
|
"Armor Battle (1978)",
|
||||||
"armorbattle",
|
|
||||||
ArmorBattle_Init,
|
ArmorBattle_Init,
|
||||||
ArmorBattle_DeInit,
|
ArmorBattle_DeInit,
|
||||||
ArmorBattle_Run,
|
ArmorBattle_Run,
|
||||||
@ -81,13 +86,13 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
ArmorBattle_GetSize,
|
ArmorBattle_GetSize,
|
||||||
armorbattle_screen_png,
|
armorbattle_screen_png,
|
||||||
ArmorBattle_Help,
|
ArmorBattle_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// auto race
|
// auto race
|
||||||
{
|
{
|
||||||
GAME_AUTORACE,
|
GAME_AUTORACE,
|
||||||
100,//65
|
100,//65
|
||||||
"Auto Race",
|
"Auto Race (1976)",
|
||||||
"autorace",
|
|
||||||
AutoRace_Init,
|
AutoRace_Init,
|
||||||
AutoRace_DeInit,
|
AutoRace_DeInit,
|
||||||
AutoRace_Run,
|
AutoRace_Run,
|
||||||
@ -99,14 +104,14 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
AutoRace_Paint,
|
AutoRace_Paint,
|
||||||
AutoRace_GetSize,
|
AutoRace_GetSize,
|
||||||
autorace_screen_png,
|
autorace_screen_png,
|
||||||
AutoRace_Help
|
AutoRace_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// baseball
|
// baseball
|
||||||
{
|
{
|
||||||
GAME_BASEBALL,
|
GAME_BASEBALL,
|
||||||
10,
|
1,
|
||||||
"Baseball",
|
"Baseball (1978)",
|
||||||
"baseball",
|
|
||||||
Baseball_Init,
|
Baseball_Init,
|
||||||
Baseball_DeInit,
|
Baseball_DeInit,
|
||||||
Baseball_Run,
|
Baseball_Run,
|
||||||
@ -118,14 +123,18 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Baseball_Paint,
|
Baseball_Paint,
|
||||||
Baseball_GetSize,
|
Baseball_GetSize,
|
||||||
baseball_screen_png,
|
baseball_screen_png,
|
||||||
Baseball_Help
|
Baseball_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
Baseball_Debug
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
// basketball
|
// basketball
|
||||||
{
|
{
|
||||||
GAME_BASKETBALL,
|
GAME_BASKETBALL,
|
||||||
60,
|
60,
|
||||||
"Basketball",
|
"Basketball (1978)",
|
||||||
"basketball",
|
|
||||||
Basketball_Init,
|
Basketball_Init,
|
||||||
Basketball_DeInit,
|
Basketball_DeInit,
|
||||||
Basketball_Run,
|
Basketball_Run,
|
||||||
@ -137,33 +146,37 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Basketball_Paint,
|
Basketball_Paint,
|
||||||
Basketball_GetSize,
|
Basketball_GetSize,
|
||||||
basketball_screen_png,
|
basketball_screen_png,
|
||||||
Basketball_Help
|
Basketball_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// basketball 2
|
// basketball 2
|
||||||
{
|
{
|
||||||
GAME_BASKETBALL2,
|
GAME_BASKETBALL2,
|
||||||
0,
|
60,
|
||||||
"Basketball II",
|
"Basketball 2 (1979)",
|
||||||
"basketball2",
|
Basketball2_Init,
|
||||||
NULL,
|
Basketball2_DeInit,
|
||||||
NULL,
|
Basketball2_Run,
|
||||||
NULL,
|
Basketball2_SetSkill,
|
||||||
NULL,
|
Basketball2_GetSkill,
|
||||||
NULL,
|
Basketball2_PowerOn,
|
||||||
NULL,
|
Basketball2_PowerOff,
|
||||||
NULL,
|
Basketball2_GetPower,
|
||||||
NULL,
|
Basketball2_Paint,
|
||||||
NULL,
|
Basketball2_GetSize,
|
||||||
NULL,
|
basketball2_screen_png,
|
||||||
nodisp_screen_png,
|
Basketball2_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
Basketball2_Debug
|
||||||
|
#else
|
||||||
NULL
|
NULL
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
// football
|
// football
|
||||||
{
|
{
|
||||||
GAME_FOOTBALL,
|
GAME_FOOTBALL,
|
||||||
55,
|
55,
|
||||||
"Football",
|
"Football (1977)",
|
||||||
"football",
|
|
||||||
Football_Init,
|
Football_Init,
|
||||||
Football_DeInit,
|
Football_DeInit,
|
||||||
Football_Run,
|
Football_Run,
|
||||||
@ -176,13 +189,13 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Football_GetSize,
|
Football_GetSize,
|
||||||
football_screen_png,
|
football_screen_png,
|
||||||
Football_Help,
|
Football_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// football 2
|
// football 2
|
||||||
{
|
{
|
||||||
GAME_FOOTBALL2,
|
GAME_FOOTBALL2,
|
||||||
50,
|
50,
|
||||||
"Football II",
|
"Football II (1978)",
|
||||||
"football2",
|
|
||||||
Football2_Init,
|
Football2_Init,
|
||||||
Football2_DeInit,
|
Football2_DeInit,
|
||||||
Football2_Run,
|
Football2_Run,
|
||||||
@ -195,13 +208,17 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Football2_GetSize,
|
Football2_GetSize,
|
||||||
football2_screen_png,
|
football2_screen_png,
|
||||||
Football2_Help,
|
Football2_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
Football2_Debug
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
// hockey
|
// hockey
|
||||||
{
|
{
|
||||||
GAME_HOCKEY,
|
GAME_HOCKEY,
|
||||||
60,
|
60,
|
||||||
"Hockey",
|
"Hockey (1978)",
|
||||||
"hockey",
|
|
||||||
Hockey_Init,
|
Hockey_Init,
|
||||||
Hockey_DeInit,
|
Hockey_DeInit,
|
||||||
Hockey_Run,
|
Hockey_Run,
|
||||||
@ -213,14 +230,14 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Hockey_Paint,
|
Hockey_Paint,
|
||||||
Hockey_GetSize,
|
Hockey_GetSize,
|
||||||
hockey_screen_png,
|
hockey_screen_png,
|
||||||
Hockey_Help
|
Hockey_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// hockey (canadian)
|
// hockey (canadian)
|
||||||
{
|
{
|
||||||
GAME_HOCKEYCA,
|
GAME_HOCKEYCA,
|
||||||
60,
|
60,
|
||||||
"Hockey (Canadian)",
|
"Hockey (Canadian) (1978)",
|
||||||
"hockeyca",
|
|
||||||
HockeyCa_Init,
|
HockeyCa_Init,
|
||||||
HockeyCa_DeInit,
|
HockeyCa_DeInit,
|
||||||
HockeyCa_Run,
|
HockeyCa_Run,
|
||||||
@ -232,14 +249,14 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
HockeyCa_Paint,
|
HockeyCa_Paint,
|
||||||
HockeyCa_GetSize,
|
HockeyCa_GetSize,
|
||||||
hockeyca_screen_png,
|
hockeyca_screen_png,
|
||||||
HockeyCa_Help
|
HockeyCa_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// ski slalom
|
// ski slalom
|
||||||
{
|
{
|
||||||
GAME_SKISLALOM,
|
GAME_SKISLALOM,
|
||||||
65,
|
65,
|
||||||
"Ski Slalom",
|
"Ski Slalom (1980)",
|
||||||
"skislalom",
|
|
||||||
SkiSlalom_Init,
|
SkiSlalom_Init,
|
||||||
AutoRace_DeInit,
|
AutoRace_DeInit,
|
||||||
AutoRace_Run,
|
AutoRace_Run,
|
||||||
@ -251,14 +268,14 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
AutoRace_Paint,
|
AutoRace_Paint,
|
||||||
AutoRace_GetSize,
|
AutoRace_GetSize,
|
||||||
skislalom_screen_png,
|
skislalom_screen_png,
|
||||||
SkiSlalom_Help
|
SkiSlalom_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// soccer
|
// soccer
|
||||||
{
|
{
|
||||||
GAME_SOCCER,
|
GAME_SOCCER,
|
||||||
60,
|
60,
|
||||||
"Soccer",
|
"Soccer (1978)",
|
||||||
"soccer",
|
|
||||||
Soccer_Init,
|
Soccer_Init,
|
||||||
Soccer_DeInit,
|
Soccer_DeInit,
|
||||||
Soccer_Run,
|
Soccer_Run,
|
||||||
@ -270,33 +287,37 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
Soccer_Paint,
|
Soccer_Paint,
|
||||||
Soccer_GetSize,
|
Soccer_GetSize,
|
||||||
soccer_screen_png,
|
soccer_screen_png,
|
||||||
Soccer_Help
|
Soccer_Help,
|
||||||
|
NULL
|
||||||
},
|
},
|
||||||
// soccer 2
|
// soccer 2
|
||||||
{
|
{
|
||||||
GAME_SOCCER2,
|
GAME_SOCCER2,
|
||||||
0,
|
60,
|
||||||
"Soccer II",
|
"Soccer 2 (1979)",
|
||||||
"soccer2",
|
Soccer2_Init,
|
||||||
NULL,
|
Soccer2_DeInit,
|
||||||
NULL,
|
Soccer2_Run,
|
||||||
NULL,
|
Soccer2_SetSkill,
|
||||||
NULL,
|
Soccer2_GetSkill,
|
||||||
NULL,
|
Soccer2_PowerOn,
|
||||||
NULL,
|
Soccer2_PowerOff,
|
||||||
NULL,
|
Soccer2_GetPower,
|
||||||
NULL,
|
Soccer2_Paint,
|
||||||
NULL,
|
Soccer2_GetSize,
|
||||||
NULL,
|
soccer2_screen_png,
|
||||||
nodisp_screen_png,
|
Soccer2_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
Soccer2_Debug
|
||||||
|
#else
|
||||||
NULL
|
NULL
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
// space alert
|
// space alert
|
||||||
{
|
{
|
||||||
GAME_SPACEALERT,
|
GAME_SPACEALERT,
|
||||||
110,
|
110,
|
||||||
"Space Alert",
|
"Space Alert (1978)",
|
||||||
"spacealert",
|
|
||||||
SpaceAlert_Init,
|
SpaceAlert_Init,
|
||||||
SpaceAlert_DeInit,
|
SpaceAlert_DeInit,
|
||||||
SpaceAlert_Run,
|
SpaceAlert_Run,
|
||||||
@ -308,14 +329,41 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
SpaceAlert_Paint,
|
SpaceAlert_Paint,
|
||||||
SpaceAlert_GetSize,
|
SpaceAlert_GetSize,
|
||||||
spacealert_screen_png,
|
spacealert_screen_png,
|
||||||
SpaceAlert_Help
|
SpaceAlert_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
SpaceAlert_Debug
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
|
},
|
||||||
|
// missile attack
|
||||||
|
{
|
||||||
|
GAME_MISSILEATTACK,
|
||||||
|
110,
|
||||||
|
"Missile Attack (1977)",
|
||||||
|
MissileAttack_Init,
|
||||||
|
SpaceAlert_DeInit,
|
||||||
|
SpaceAlert_Run,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
SpaceAlert_PowerOn,
|
||||||
|
SpaceAlert_PowerOff,
|
||||||
|
SpaceAlert_GetPower,
|
||||||
|
SpaceAlert_Paint,
|
||||||
|
SpaceAlert_GetSize,
|
||||||
|
missileattack_screen_png,
|
||||||
|
MissileAttack_Help,
|
||||||
|
#ifdef DEEP_DEBUG
|
||||||
|
SpaceAlert_Debug
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
// subchase
|
// subchase
|
||||||
{
|
{
|
||||||
GAME_SUBCHASE,
|
GAME_SUBCHASE,
|
||||||
60,
|
60,
|
||||||
"Sub Chase",
|
"Sub Chase (1978)",
|
||||||
"subchase",
|
|
||||||
SubChase_Init,
|
SubChase_Init,
|
||||||
SubChase_DeInit,
|
SubChase_DeInit,
|
||||||
SubChase_Run,
|
SubChase_Run,
|
||||||
@ -327,7 +375,8 @@ GAMECONTEXT gGameContext[NUM_GAMES] =
|
|||||||
SubChase_Paint,
|
SubChase_Paint,
|
||||||
SubChase_GetSize,
|
SubChase_GetSize,
|
||||||
subchase_screen_png,
|
subchase_screen_png,
|
||||||
SubChase_Help
|
SubChase_Help,
|
||||||
|
NULL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ Website : http://www.peterhirschberg.com
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GAMES_H__
|
#ifndef __GAMES_H__
|
||||||
#define __GAMES_H__
|
#define __GAMES_H__
|
||||||
|
|
||||||
@ -51,9 +50,11 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define GAME_SOCCER 10
|
#define GAME_SOCCER 10
|
||||||
#define GAME_SOCCER2 11
|
#define GAME_SOCCER2 11
|
||||||
#define GAME_SPACEALERT 12
|
#define GAME_SPACEALERT 12
|
||||||
#define GAME_SUBCHASE 13
|
#define GAME_MISSILEATTACK 13
|
||||||
|
#define GAME_SUBCHASE 14
|
||||||
|
|
||||||
#define NUM_GAMES 14
|
|
||||||
|
#define NUM_GAMES 15
|
||||||
|
|
||||||
typedef struct GAMECONTEXT
|
typedef struct GAMECONTEXT
|
||||||
{
|
{
|
||||||
@ -64,7 +65,6 @@ typedef struct GAMECONTEXT
|
|||||||
int tu;
|
int tu;
|
||||||
|
|
||||||
char *szName;
|
char *szName;
|
||||||
char *szDir;
|
|
||||||
|
|
||||||
void (*Init)(void);
|
void (*Init)(void);
|
||||||
void (*DeInit)(void);
|
void (*DeInit)(void);
|
||||||
@ -78,6 +78,7 @@ typedef struct GAMECONTEXT
|
|||||||
void (*GetSize)(int *w, int *h);
|
void (*GetSize)(int *w, int *h);
|
||||||
const u8 *screen;
|
const u8 *screen;
|
||||||
void (*Help)(void);
|
void (*Help)(void);
|
||||||
|
void (*Debug)(int f);
|
||||||
}GAMECONTEXT;
|
}GAMECONTEXT;
|
||||||
|
|
||||||
extern GAMECONTEXT gGameContext[NUM_GAMES];
|
extern GAMECONTEXT gGameContext[NUM_GAMES];
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
* LEDhead for Wii
|
* LEDhead for Wii
|
||||||
* Copyright (C) 2017-2020 Nebiun
|
* Copyright (C) 2017-2020 Nebiun
|
||||||
*
|
*
|
||||||
|
* Based on the handheld electronic games by Mattel Electronics.
|
||||||
|
* All trademarks copyrighted by their respective owners. This
|
||||||
|
* program is not affiliated or endorsed by Mattel Electronics.
|
||||||
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -30,13 +34,18 @@
|
|||||||
#define IR_X_CORRECTION 64
|
#define IR_X_CORRECTION 64
|
||||||
#define IR_Y_CORRECTION 20
|
#define IR_Y_CORRECTION 20
|
||||||
|
|
||||||
#define realx(x) ((x) + (rmode->viWidth - 240)/2)
|
#define SCALE_X _scale_x
|
||||||
#define realy(y) ((y) + 20)
|
#define SCALE_Y _scale_y
|
||||||
|
#define realx(x) (((x)*SCALE_X) + (rmode->viWidth - 240*SCALE_X)/2)
|
||||||
|
#define realy(y) (((y)*SCALE_Y) + 20)
|
||||||
|
|
||||||
// draw_poweroff_a modes
|
// draw_poweroff_a modes
|
||||||
#define POWER_POS_OFF 0
|
#define SWITCH_POS_OFF 0
|
||||||
#define POWER_POS_MODE1 1
|
#define SWITCH_POS_ON 1
|
||||||
#define POWER_POS_MODE2 2
|
#define SWITCH_POS_MODE1 2
|
||||||
|
#define SWITCH_POS_MODE2 3
|
||||||
|
#define SWITCH_POS_PRO1 4
|
||||||
|
#define SWITCH_POS_PRO2 5
|
||||||
|
|
||||||
// draw_vblip/draw_oblip modes
|
// draw_vblip/draw_oblip modes
|
||||||
#define BLIP_TYPE_NORMAL 0
|
#define BLIP_TYPE_NORMAL 0
|
||||||
@ -48,17 +57,29 @@
|
|||||||
#define DIGIT_TYPE_FLOAT 1
|
#define DIGIT_TYPE_FLOAT 1
|
||||||
#define DIGIT_TYPE_SPECIAL 2
|
#define DIGIT_TYPE_SPECIAL 2
|
||||||
|
|
||||||
extern int trace;
|
// Switch types
|
||||||
|
#define SWITCH_TYPE_1 0 /* like baseball, football2 */
|
||||||
|
#define SWITCH_TYPE_2 1 /* like basketball, hockey, soccer */
|
||||||
|
#define SWITCH_TYPE_3 3 /* like football */
|
||||||
|
#define SWITCH_TYPE_4 4 /* like basketball2, soccer2 */
|
||||||
|
|
||||||
|
extern f32 _scale_x, _scale_y;
|
||||||
|
|
||||||
extern void print_text(int x, int y, u32 rgba, const char *fmt, ...);
|
extern void print_text(int x, int y, u32 rgba, const char *fmt, ...);
|
||||||
|
|
||||||
extern int draw_digit(int x, int y, int val);
|
extern int draw_digit(int x, int y, int val);
|
||||||
extern int print_digit(int x, int y, int pass, int val, int max);
|
extern int print_digit(int x, int y, int pass, int val, int max);
|
||||||
extern int draw_digit_f(int x, int y, int val, int flag);
|
extern int draw_digit_f(int x, int y, int val, int flag);
|
||||||
|
|
||||||
extern int draw_poweroff_a(int x, int y, int val);
|
|
||||||
extern int draw_vblip(int x, int y, int type);
|
extern int draw_vblip(int x, int y, int type);
|
||||||
extern int draw_oblip(int x, int y, int type);
|
extern int draw_oblip(int x, int y, int type);
|
||||||
|
|
||||||
|
extern int draw_gear(int x, int y, int pos);
|
||||||
|
extern void destroy_gear(void);
|
||||||
|
|
||||||
|
extern int draw_switch(int type, int x, int y, int pos);
|
||||||
|
extern void destroy_switch(void);
|
||||||
|
|
||||||
extern void debugPrintf(int x, int y, u32 rgba, const char *fmt, ...);
|
extern void debugPrintf(int x, int y, u32 rgba, const char *fmt, ...);
|
||||||
extern void debugDestroy(void);
|
extern void debugDestroy(void);
|
||||||
#endif
|
#endif
|
@ -2,6 +2,10 @@
|
|||||||
* LEDhead for Wii
|
* LEDhead for Wii
|
||||||
* Copyright (C) 2017-2020 Nebiun
|
* Copyright (C) 2017-2020 Nebiun
|
||||||
*
|
*
|
||||||
|
* Based on the handheld electronic games by Mattel Electronics.
|
||||||
|
* All trademarks copyrighted by their respective owners. This
|
||||||
|
* program is not affiliated or endorsed by Mattel Electronics.
|
||||||
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -15,7 +19,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LED_Handled.h"
|
#include "LED_Handled.h"
|
||||||
#include "v_blip_png.h"
|
#include "v_blip_png.h"
|
||||||
#include "o_blip_png.h"
|
#include "o_blip_png.h"
|
||||||
@ -41,7 +45,7 @@ static inline int _drawBlip(int x, int y, int type, GRRLIB_texImg *blip)
|
|||||||
idx = 0;
|
idx = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GRRLIB_DrawTile(realx(x), realy(y), blip, 0, 1, 1, 0xFFFFFFFF, idx);
|
GRRLIB_DrawTile(realx(x), realy(y), blip, 0, SCALE_X, SCALE_Y, 0xFFFFFFFF, idx);
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
* LEDhead for Wii
|
* LEDhead for Wii
|
||||||
* Copyright (C) 2017-2020 Nebiun
|
* Copyright (C) 2017-2020 Nebiun
|
||||||
*
|
*
|
||||||
|
* Based on the handheld electronic games by Mattel Electronics.
|
||||||
|
* All trademarks copyrighted by their respective owners. This
|
||||||
|
* program is not affiliated or endorsed by Mattel Electronics.
|
||||||
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -15,7 +19,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LED_Handled.h"
|
#include "LED_Handled.h"
|
||||||
#include "digits_f_png.h"
|
#include "digits_f_png.h"
|
||||||
|
|
||||||
@ -48,13 +52,13 @@ int draw_digit_f(int x, int y, int val, int flag)
|
|||||||
idx = 12 + val%10;
|
idx = 12 + val%10;
|
||||||
break;
|
break;
|
||||||
case DIGIT_TYPE_SPECIAL:
|
case DIGIT_TYPE_SPECIAL:
|
||||||
idx = 23 + val%2;
|
idx = 22 + val%4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(idx < 0)
|
if(idx < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
GRRLIB_DrawTile(realx(x), realy(y), digit, 0, 1, 1, 0xFFFFFFFF, idx);
|
GRRLIB_DrawTile(realx(x), realy(y), digit, 0, SCALE_X, SCALE_Y, 0xFFFFFFFF, idx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
* LEDhead for Wii
|
* LEDhead for Wii
|
||||||
* Copyright (C) 2017-2020 Nebiun
|
* Copyright (C) 2017-2020 Nebiun
|
||||||
*
|
*
|
||||||
|
* Based on the handheld electronic games by Mattel Electronics.
|
||||||
|
* All trademarks copyrighted by their respective owners. This
|
||||||
|
* program is not affiliated or endorsed by Mattel Electronics.
|
||||||
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -50,8 +50,9 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define ARMORBATTLE_SOUND_HIT 4
|
#define ARMORBATTLE_SOUND_HIT 4
|
||||||
#define ARMORBATTLE_SOUND_SCORE 5
|
#define ARMORBATTLE_SOUND_SCORE 5
|
||||||
#define ARMORBATTLE_SOUND_ENDGAME 6
|
#define ARMORBATTLE_SOUND_ENDGAME 6
|
||||||
|
#define ARMORBATTLE_SOUND_NSOUNDS 7
|
||||||
|
|
||||||
void ArmorBattle_Run();
|
void ArmorBattle_Run(int tu);
|
||||||
void ArmorBattle_SetSkill(int i);
|
void ArmorBattle_SetSkill(int i);
|
||||||
int ArmorBattle_GetSkill();
|
int ArmorBattle_GetSkill();
|
||||||
void ArmorBattle_PowerOn();
|
void ArmorBattle_PowerOn();
|
||||||
|
@ -50,8 +50,9 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define AUTORACE_SOUND_HIT 4
|
#define AUTORACE_SOUND_HIT 4
|
||||||
#define AUTORACE_SOUND_TIME 5
|
#define AUTORACE_SOUND_TIME 5
|
||||||
#define AUTORACE_SOUND_WIN 6
|
#define AUTORACE_SOUND_WIN 6
|
||||||
|
#define AUTORACE_SOUND_NSOUNDS 7
|
||||||
|
|
||||||
void AutoRace_Run();
|
void AutoRace_Run(int tu);
|
||||||
void AutoRace_SetSkill(int i);
|
void AutoRace_SetSkill(int i);
|
||||||
int AutoRace_GetSkill();
|
int AutoRace_GetSkill();
|
||||||
void AutoRace_PowerOn();
|
void AutoRace_PowerOn();
|
||||||
|
@ -36,7 +36,7 @@ Website : http://www.peterhirschberg.com
|
|||||||
|
|
||||||
#ifndef __BASEBALL_H__
|
#ifndef __BASEBALL_H__
|
||||||
#define __BASEBALL_H__
|
#define __BASEBALL_H__
|
||||||
|
#include <sys/time.h>
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Platform_Baseball.h"
|
#include "Platform_Baseball.h"
|
||||||
|
|
||||||
@ -47,15 +47,10 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define BASEBALL_SOUND_STRIKE 3
|
#define BASEBALL_SOUND_STRIKE 3
|
||||||
#define BASEBALL_SOUND_ENDPOSSESSION 4
|
#define BASEBALL_SOUND_ENDPOSSESSION 4
|
||||||
#define BASEBALL_SOUND_ENDGAME 5
|
#define BASEBALL_SOUND_ENDGAME 5
|
||||||
|
#define BASEBALL_SOUND_NSOUNDS 6
|
||||||
|
|
||||||
|
void Baseball_Run(int tu);
|
||||||
void Baseball_Run();
|
void Baseball_Debug(int f);
|
||||||
void Baseball_SetSkill(int i);
|
|
||||||
int Baseball_GetSkill();
|
|
||||||
void Baseball_PowerOn();
|
|
||||||
void Baseball_PowerOff();
|
|
||||||
int Baseball_GetPower();
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ static PLAYER defense[NUM_DEFENSEPLAYERS];
|
|||||||
p.nColumn++; \
|
p.nColumn++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISBALL(int x, int y);
|
|
||||||
static BOOL ISBALL(int x, int y)
|
static BOOL ISBALL(int x, int y)
|
||||||
{
|
{
|
||||||
if ((ball.nColumn == x)
|
if ((ball.nColumn == x)
|
||||||
@ -142,7 +141,6 @@ static BOOL ISBALL(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISPLAYER(int x, int y);
|
|
||||||
static BOOL ISPLAYER(int x, int y)
|
static BOOL ISPLAYER(int x, int y)
|
||||||
{
|
{
|
||||||
if ((player.nColumn == x)
|
if ((player.nColumn == x)
|
||||||
@ -153,7 +151,6 @@ static BOOL ISPLAYER(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISDEFENSE(int x, int y);
|
|
||||||
static BOOL ISDEFENSE(int x, int y)
|
static BOOL ISDEFENSE(int x, int y)
|
||||||
{
|
{
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
@ -166,7 +163,6 @@ static BOOL ISDEFENSE(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISOCCUPIED(int x, int y);
|
|
||||||
static BOOL ISOCCUPIED(int x, int y)
|
static BOOL ISOCCUPIED(int x, int y)
|
||||||
{
|
{
|
||||||
if (ISPLAYER(x,y)){
|
if (ISPLAYER(x,y)){
|
||||||
@ -178,7 +174,6 @@ static BOOL ISOCCUPIED(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GETPLAYERAT(int x, int y);
|
|
||||||
static int GETPLAYERAT(int x, int y){
|
static int GETPLAYERAT(int x, int y){
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
if ((defense[i].nColumn == x)
|
if ((defense[i].nColumn == x)
|
||||||
@ -205,8 +200,6 @@ static int GETPLAYERAT(int x, int y){
|
|||||||
#define ISPLAYERENABLED(p) \
|
#define ISPLAYERENABLED(p) \
|
||||||
(p.nBright)
|
(p.nBright)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finite state machine stuff
|
// finite state machine stuff
|
||||||
|
|
||||||
static void fsmPlayStartWait();
|
static void fsmPlayStartWait();
|
||||||
@ -234,43 +227,7 @@ static FSMFCN fsmfcn[] = {
|
|||||||
fsmGameOver
|
fsmGameOver
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void InitGame()
|
||||||
// proto's
|
|
||||||
static void InitGame();
|
|
||||||
static void DrawBlips();
|
|
||||||
static void EraseBlips();
|
|
||||||
|
|
||||||
|
|
||||||
BOOL Basketball_GetPower()
|
|
||||||
{
|
|
||||||
return (bPower ? TRUE : FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Basketball_PowerOn()
|
|
||||||
{
|
|
||||||
InitGame();
|
|
||||||
bPower = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Basketball_PowerOff()
|
|
||||||
{
|
|
||||||
bPower = FALSE;
|
|
||||||
Basketball_StopSound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Basketball_SetSkill(int i){
|
|
||||||
if (i == 0){
|
|
||||||
bPro2 = FALSE;
|
|
||||||
} else {
|
|
||||||
bPro2 = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Basketball_GetSkill(){
|
|
||||||
return bPro2 ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitGame()
|
|
||||||
{
|
{
|
||||||
bHomeTeam = FALSE;
|
bHomeTeam = FALSE;
|
||||||
PlatformSetInput(bHomeTeam);
|
PlatformSetInput(bHomeTeam);
|
||||||
@ -285,40 +242,7 @@ void InitGame()
|
|||||||
fsm = FSM_PLAYSTARTWAIT;
|
fsm = FSM_PLAYSTARTWAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Basketball_Run(int tu)
|
static void DrawBlips()
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
// prevent reentrancy
|
|
||||||
if (bInFrame){ return; }
|
|
||||||
bInFrame = TRUE;
|
|
||||||
|
|
||||||
// init the blips field
|
|
||||||
for (y = 0; y < BASKETBALL_BLIP_ROWS; y++){
|
|
||||||
for (x = 0; x < BASKETBALL_BLIP_COLUMNS; x++){
|
|
||||||
Blips[x][y] = BLIP_OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bPower){
|
|
||||||
Basketball_ClearScreen();
|
|
||||||
bInFrame = FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform_StartDraw();
|
|
||||||
|
|
||||||
(fsmfcn[fsm])();
|
|
||||||
|
|
||||||
DrawBlips();
|
|
||||||
|
|
||||||
Platform_EndDraw();
|
|
||||||
|
|
||||||
bInFrame = FALSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawBlips()
|
|
||||||
{
|
{
|
||||||
int x, y, nBright;
|
int x, y, nBright;
|
||||||
static BOOL bBlink = FALSE;
|
static BOOL bBlink = FALSE;
|
||||||
@ -377,16 +301,69 @@ void DrawBlips()
|
|||||||
bBlink = !bBlink;
|
bBlink = !bBlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EraseBlips()
|
BOOL Basketball_GetPower()
|
||||||
{
|
{
|
||||||
// erase the blips field
|
return (bPower ? TRUE : FALSE);
|
||||||
for (int y = 0; y < BASKETBALL_BLIP_ROWS; y++){
|
}
|
||||||
for (int x = 0; x < BASKETBALL_BLIP_COLUMNS; x++){
|
|
||||||
Basketball_DrawBlip(BLIP_OFF, x, y);
|
void Basketball_PowerOn()
|
||||||
}
|
{
|
||||||
|
InitGame();
|
||||||
|
bPower = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Basketball_PowerOff()
|
||||||
|
{
|
||||||
|
bPower = FALSE;
|
||||||
|
Basketball_StopSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Basketball_SetSkill(int i){
|
||||||
|
if (i == 0){
|
||||||
|
bPro2 = FALSE;
|
||||||
|
} else {
|
||||||
|
bPro2 = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Basketball_GetSkill(){
|
||||||
|
return bPro2 ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Basketball_Run(int tu)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
// prevent reentrancy
|
||||||
|
if (bInFrame){ return; }
|
||||||
|
bInFrame = TRUE;
|
||||||
|
|
||||||
|
// init the blips field
|
||||||
|
for (y = 0; y < BASKETBALL_BLIP_ROWS; y++){
|
||||||
|
for (x = 0; x < BASKETBALL_BLIP_COLUMNS; x++){
|
||||||
|
Blips[x][y] = BLIP_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bPower){
|
||||||
|
Basketball_ClearScreen();
|
||||||
|
bInFrame = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Platform_StartDraw();
|
||||||
|
|
||||||
|
(fsmfcn[fsm])();
|
||||||
|
|
||||||
|
DrawBlips();
|
||||||
|
|
||||||
|
Platform_EndDraw();
|
||||||
|
|
||||||
|
bInFrame = FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FINITE STATE MACHINE STUFF
|
// FINITE STATE MACHINE STUFF
|
||||||
|
|
||||||
void fsmPlayStartWait()
|
void fsmPlayStartWait()
|
||||||
|
@ -49,8 +49,9 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define BASKETBALL_SOUND_ENDPLAY 3
|
#define BASKETBALL_SOUND_ENDPLAY 3
|
||||||
#define BASKETBALL_SOUND_ENDQUARTER 4
|
#define BASKETBALL_SOUND_ENDQUARTER 4
|
||||||
#define BASKETBALL_SOUND_ENDGAME 5
|
#define BASKETBALL_SOUND_ENDGAME 5
|
||||||
|
#define BASKETBALL_SOUND_NSOUNDS 6
|
||||||
|
|
||||||
void Basketball_Run();
|
void Basketball_Run(int tu);
|
||||||
void Basketball_SetSkill(int i);
|
void Basketball_SetSkill(int i);
|
||||||
int Basketball_GetSkill();
|
int Basketball_GetSkill();
|
||||||
void Basketball_PowerOn();
|
void Basketball_PowerOn();
|
||||||
|
1340
source/game/Basketball2.c
Normal file
55
source/game/Basketball2.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* LEDhead for Wii
|
||||||
|
* Copyright (C) 2017-2020 Nebiun
|
||||||
|
*
|
||||||
|
* Based on the handheld electronic games by Mattel Electronics.
|
||||||
|
* All trademarks copyrighted by their respective owners. This
|
||||||
|
* program is not affiliated or endorsed by Mattel Electronics.
|
||||||
|
*
|
||||||
|
* 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __BASKETBALL2_H__
|
||||||
|
#define __BASKETBALL2_H__
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
#include "Platform_Basketball2.h"
|
||||||
|
|
||||||
|
#define BASKETBALL2_BLIP_ROWS 5
|
||||||
|
#define BASKETBALL2_BLIP_COLUMNS 7
|
||||||
|
|
||||||
|
#define BASKETBALL2_SOUND_TICK 0
|
||||||
|
#define BASKETBALL2_SOUND_BOUNCE 1
|
||||||
|
#define BASKETBALL2_SOUND_SCORE 2 // Four-note fanfare
|
||||||
|
#define BASKETBALL2_SOUND_ENDPLAY 3 // Two whistles
|
||||||
|
#define BASKETBALL2_SOUND_ENDQUARTER 4 // Buzzer
|
||||||
|
#define BASKETBALL2_SOUND_ENDGAME 5 // Long buzzer
|
||||||
|
#define BASKETBALL2_SOUND_SCORE3 6 // Double fanfare
|
||||||
|
#define BASKETBALL2_SOUND_FOUL 7 // One whistle
|
||||||
|
#define BASKETBALL2_SOUND_3SECS 8 // Three whistles
|
||||||
|
#define BASKETBALL2_SOUND_FREETHROW 9 // Two-note fanfare
|
||||||
|
#define BASKETBALL2_SOUND_OVERTIME 10 // Two buzzers
|
||||||
|
#define BASKETBALL2_SOUND_NSOUNDS 11
|
||||||
|
|
||||||
|
|
||||||
|
void Basketball2_Run(int tu);
|
||||||
|
void Basketball2_SetSkill(int i);
|
||||||
|
int Basketball2_GetSkill();
|
||||||
|
void Basketball2_PowerOn();
|
||||||
|
void Basketball2_PowerOff();
|
||||||
|
BOOL Basketball2_GetPower();
|
||||||
|
void Basketball2_Debug(int f);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -181,18 +181,6 @@ static PLAYER player[NUM_DEFENSEPLAYERS];
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISBALL(int x, int y);
|
|
||||||
static BOOL ISBALL(int x, int y)
|
|
||||||
{
|
|
||||||
if ((ball.nColumn == x)
|
|
||||||
&& (ball.nLane == y)
|
|
||||||
&& (ball.nBright)){
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL ISDEFENSE(int x, int y);
|
|
||||||
static BOOL ISDEFENSE(int x, int y)
|
static BOOL ISDEFENSE(int x, int y)
|
||||||
{
|
{
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
@ -205,19 +193,6 @@ static BOOL ISDEFENSE(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISOCCUPIED(int x, int y);
|
|
||||||
static BOOL ISOCCUPIED(int x, int y)
|
|
||||||
{
|
|
||||||
if (ISBALL(x,y)){
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
if (ISDEFENSE(x,y)){
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int GETPLAYERAT(int x, int y);
|
|
||||||
static int GETPLAYERAT(int x, int y){
|
static int GETPLAYERAT(int x, int y){
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
if ((player[i].nColumn == x)
|
if ((player[i].nColumn == x)
|
||||||
@ -238,8 +213,6 @@ static int GETPLAYERAT(int x, int y){
|
|||||||
#define ISPLAYEROFFSCREEN(p) \
|
#define ISPLAYEROFFSCREEN(p) \
|
||||||
((p.nColumn > FOOTBALL_BLIP_COLUMNS-1) || (p.nColumn < 0))
|
((p.nColumn > FOOTBALL_BLIP_COLUMNS-1) || (p.nColumn < 0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finite state machine stuff
|
// finite state machine stuff
|
||||||
|
|
||||||
static void fsmFormation();
|
static void fsmFormation();
|
||||||
@ -263,12 +236,93 @@ static FSMFCN fsmfcn[] = {
|
|||||||
fsmGameOver
|
fsmGameOver
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void InitGame()
|
||||||
|
{
|
||||||
|
bHomeTeam = TRUE;
|
||||||
|
PlatformSetInput(bHomeTeam);
|
||||||
|
|
||||||
|
nHScore = 0;
|
||||||
|
nVScore = 0;
|
||||||
|
fGameTime = 15.0;
|
||||||
|
nDown = 0;
|
||||||
|
nQuarter = 0;
|
||||||
|
nCurrentYardline = 100 - 20;
|
||||||
|
nFirstDownYard = nCurrentYardline - 10;
|
||||||
|
|
||||||
// proto's
|
bDisplayScore = FALSE;
|
||||||
static void InitGame();
|
bDisplayTime = FALSE;
|
||||||
static void DrawBlips();
|
bDisplayYard = FALSE;
|
||||||
static void EraseBlips();
|
bDisplayDown = FALSE;
|
||||||
|
bDisplayBlips = TRUE;
|
||||||
|
|
||||||
|
fsm = FSM_FORMATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawBlips()
|
||||||
|
{
|
||||||
|
int x, y, nBright;
|
||||||
|
static int nBlinkTimer = 0;
|
||||||
|
static BOOL bBlink = FALSE;
|
||||||
|
|
||||||
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
|
if (player[i].nBright != BLIP_OFF){
|
||||||
|
x = player[i].nColumn % 10;
|
||||||
|
y = player[i].nLane;
|
||||||
|
nBright = player[i].nBright;
|
||||||
|
Blips[x][y] = nBright;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ball.nBright != BLIP_OFF){
|
||||||
|
x = ball.nColumn % 10;
|
||||||
|
y = ball.nLane;
|
||||||
|
nBright = ball.nBright;
|
||||||
|
Blips[x][y] = nBright;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the blips field
|
||||||
|
for (y = 0; y < FOOTBALL_BLIP_ROWS; y++){
|
||||||
|
for (x = 0; x < FOOTBALL_BLIP_COLUMNS; x++){
|
||||||
|
|
||||||
|
switch(Blips[x][y]){
|
||||||
|
case BLIP_OFF:
|
||||||
|
case BLIP_DIM:
|
||||||
|
case BLIP_BRIGHT:
|
||||||
|
Football_DrawBlip(Blips[x][y], x, y);
|
||||||
|
break;
|
||||||
|
case BLIP_DIMBLINK:
|
||||||
|
if (!bBlink){
|
||||||
|
Football_DrawBlip(BLIP_DIM, x, y);
|
||||||
|
} else {
|
||||||
|
Football_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BLIP_BRIGHTBLINK:
|
||||||
|
if (bBlink){
|
||||||
|
Football_DrawBlip(BLIP_BRIGHT, x, y);
|
||||||
|
} else {
|
||||||
|
Football_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--nBlinkTimer <= 0){
|
||||||
|
nBlinkTimer = 4;
|
||||||
|
bBlink = !bBlink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EraseBlips()
|
||||||
|
{
|
||||||
|
// erase the blips field
|
||||||
|
for (int y = 0; y < FOOTBALL_BLIP_ROWS; y++){
|
||||||
|
for (int x = 0; x < FOOTBALL_BLIP_COLUMNS; x++){
|
||||||
|
Football_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL Football_GetPower()
|
BOOL Football_GetPower()
|
||||||
{
|
{
|
||||||
@ -299,28 +353,6 @@ int Football_GetSkill(){
|
|||||||
return bPro2 ? 1 : 0;
|
return bPro2 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitGame()
|
|
||||||
{
|
|
||||||
bHomeTeam = TRUE;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
|
|
||||||
nHScore = 0;
|
|
||||||
nVScore = 0;
|
|
||||||
fGameTime = 15.0;
|
|
||||||
nDown = 0;
|
|
||||||
nQuarter = 0;
|
|
||||||
nCurrentYardline = 100 - 20;
|
|
||||||
nFirstDownYard = nCurrentYardline - 10;
|
|
||||||
|
|
||||||
bDisplayScore = FALSE;
|
|
||||||
bDisplayTime = FALSE;
|
|
||||||
bDisplayYard = FALSE;
|
|
||||||
bDisplayDown = FALSE;
|
|
||||||
bDisplayBlips = TRUE;
|
|
||||||
|
|
||||||
fsm = FSM_FORMATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Football_Run(int tu)
|
void Football_Run(int tu)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -388,72 +420,6 @@ void Football_Run(int tu)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBlips()
|
|
||||||
{
|
|
||||||
int x, y, nBright;
|
|
||||||
static int nBlinkTimer = 0;
|
|
||||||
static BOOL bBlink = FALSE;
|
|
||||||
|
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
|
||||||
if (player[i].nBright != BLIP_OFF){
|
|
||||||
x = player[i].nColumn % 10;
|
|
||||||
y = player[i].nLane;
|
|
||||||
nBright = player[i].nBright;
|
|
||||||
Blips[x][y] = nBright;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ball.nBright != BLIP_OFF){
|
|
||||||
x = ball.nColumn % 10;
|
|
||||||
y = ball.nLane;
|
|
||||||
nBright = ball.nBright;
|
|
||||||
Blips[x][y] = nBright;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw the blips field
|
|
||||||
for (y = 0; y < FOOTBALL_BLIP_ROWS; y++){
|
|
||||||
for (x = 0; x < FOOTBALL_BLIP_COLUMNS; x++){
|
|
||||||
|
|
||||||
switch(Blips[x][y]){
|
|
||||||
case BLIP_OFF:
|
|
||||||
case BLIP_DIM:
|
|
||||||
case BLIP_BRIGHT:
|
|
||||||
Football_DrawBlip(Blips[x][y], x, y);
|
|
||||||
break;
|
|
||||||
case BLIP_DIMBLINK:
|
|
||||||
if (!bBlink){
|
|
||||||
Football_DrawBlip(BLIP_DIM, x, y);
|
|
||||||
} else {
|
|
||||||
Football_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BLIP_BRIGHTBLINK:
|
|
||||||
if (bBlink){
|
|
||||||
Football_DrawBlip(BLIP_BRIGHT, x, y);
|
|
||||||
} else {
|
|
||||||
Football_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (--nBlinkTimer <= 0){
|
|
||||||
nBlinkTimer = 4;
|
|
||||||
bBlink = !bBlink;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EraseBlips()
|
|
||||||
{
|
|
||||||
// erase the blips field
|
|
||||||
for (int y = 0; y < FOOTBALL_BLIP_ROWS; y++){
|
|
||||||
for (int x = 0; x < FOOTBALL_BLIP_COLUMNS; x++){
|
|
||||||
Football_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FINITE STATE MACHINE STUFF
|
// FINITE STATE MACHINE STUFF
|
||||||
|
|
||||||
static void fsmFormation()
|
static void fsmFormation()
|
||||||
@ -793,7 +759,6 @@ static void fsmPlayEnded()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fsmGameOver()
|
static void fsmGameOver()
|
||||||
{
|
{
|
||||||
bDisplayTime = TRUE;
|
bDisplayTime = TRUE;
|
||||||
@ -802,8 +767,3 @@ static void fsmGameOver()
|
|||||||
bDisplayDown = FALSE;
|
bDisplayDown = FALSE;
|
||||||
bDisplayBlips = FALSE;
|
bDisplayBlips = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,12 +44,13 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define FOOTBALL_BLIP_ROWS 3
|
#define FOOTBALL_BLIP_ROWS 3
|
||||||
#define FOOTBALL_BLIP_COLUMNS 9
|
#define FOOTBALL_BLIP_COLUMNS 9
|
||||||
|
|
||||||
#define FOOTBALL_SOUND_TICK 0
|
#define FOOTBALL_SOUND_TICK 0
|
||||||
#define FOOTBALL_SOUND_ENDPLAY 1
|
#define FOOTBALL_SOUND_ENDPLAY 1
|
||||||
#define FOOTBALL_SOUND_ENDPOSSESSION 2
|
#define FOOTBALL_SOUND_ENDPOSSESSION 2
|
||||||
#define FOOTBALL_SOUND_SCORE 3
|
#define FOOTBALL_SOUND_SCORE 3
|
||||||
|
#define FOOTBALL_SOUND_NSOUDS 4
|
||||||
|
|
||||||
void Football_Run();
|
void Football_Run(int tu);
|
||||||
void Football_SetSkill(int i);
|
void Football_SetSkill(int i);
|
||||||
int Football_GetSkill();
|
int Football_GetSkill();
|
||||||
void Football_PowerOn();
|
void Football_PowerOn();
|
||||||
|
@ -49,7 +49,6 @@ static BLIP Blips[FOOTBALL2_BLIP_COLUMNS][FOOTBALL2_BLIP_ROWS];
|
|||||||
static BOOL bHomeTeam;
|
static BOOL bHomeTeam;
|
||||||
static BOOL bInFrame = FALSE;
|
static BOOL bInFrame = FALSE;
|
||||||
static BOOL bPower;
|
static BOOL bPower;
|
||||||
static BOOL bPro2 = FALSE;
|
|
||||||
static BOOL bGotFirstDown;
|
static BOOL bGotFirstDown;
|
||||||
|
|
||||||
static BOOL bDisplayScore;
|
static BOOL bDisplayScore;
|
||||||
@ -65,7 +64,7 @@ static int nFirstDownYard;
|
|||||||
static int nDown;
|
static int nDown;
|
||||||
static int nQuarter;
|
static int nQuarter;
|
||||||
static int nCurrentYardline;
|
static int nCurrentYardline;
|
||||||
|
static int nLevel = -1;
|
||||||
static int nPassingStart;
|
static int nPassingStart;
|
||||||
|
|
||||||
static int nKickoffStart;
|
static int nKickoffStart;
|
||||||
@ -190,7 +189,6 @@ static PLAYER player[NUM_DEFENSEPLAYERS];
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISBALL(int x, int y);
|
|
||||||
static BOOL ISBALL(int x, int y)
|
static BOOL ISBALL(int x, int y)
|
||||||
{
|
{
|
||||||
if ((ball.nColumn == x)
|
if ((ball.nColumn == x)
|
||||||
@ -201,7 +199,6 @@ static BOOL ISBALL(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISRECEIVER(int x, int y);
|
|
||||||
static BOOL ISRECEIVER(int x, int y)
|
static BOOL ISRECEIVER(int x, int y)
|
||||||
{
|
{
|
||||||
if ((receiver.nColumn == x)
|
if ((receiver.nColumn == x)
|
||||||
@ -212,7 +209,6 @@ static BOOL ISRECEIVER(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISDEFENSE(int x, int y);
|
|
||||||
static BOOL ISDEFENSE(int x, int y)
|
static BOOL ISDEFENSE(int x, int y)
|
||||||
{
|
{
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
@ -225,7 +221,6 @@ static BOOL ISDEFENSE(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISOCCUPIED(int x, int y);
|
|
||||||
static BOOL ISOCCUPIED(int x, int y)
|
static BOOL ISOCCUPIED(int x, int y)
|
||||||
{
|
{
|
||||||
if (ISBALL(x,y)){
|
if (ISBALL(x,y)){
|
||||||
@ -240,7 +235,6 @@ static BOOL ISOCCUPIED(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GETPLAYERAT(int x, int y);
|
|
||||||
static int GETPLAYERAT(int x, int y){
|
static int GETPLAYERAT(int x, int y){
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
if ((player[i].nColumn == x)
|
if ((player[i].nColumn == x)
|
||||||
@ -262,7 +256,6 @@ static int GETPLAYERAT(int x, int y){
|
|||||||
((p.nColumn > FOOTBALL2_BLIP_COLUMNS-1) || (p.nColumn < 0))
|
((p.nColumn > FOOTBALL2_BLIP_COLUMNS-1) || (p.nColumn < 0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finite state machine stuff
|
// finite state machine stuff
|
||||||
|
|
||||||
static void fsmKickoffWait();
|
static void fsmKickoffWait();
|
||||||
@ -277,8 +270,11 @@ static void fsmPassing();
|
|||||||
static void fsmSafety();
|
static void fsmSafety();
|
||||||
static void fsmPlayEnded();
|
static void fsmPlayEnded();
|
||||||
static void fsmGameOver();
|
static void fsmGameOver();
|
||||||
|
static void fsmTurnover();
|
||||||
|
static void fsmOutPlay();
|
||||||
|
|
||||||
static enum FSM {
|
enum FSM {
|
||||||
|
FSM_INVALID=-1,
|
||||||
FSM_KICKOFFWAIT=0,
|
FSM_KICKOFFWAIT=0,
|
||||||
FSM_KICKOFFCHARGE,
|
FSM_KICKOFFCHARGE,
|
||||||
FSM_KICKOFFMIDAIR,
|
FSM_KICKOFFMIDAIR,
|
||||||
@ -290,8 +286,12 @@ static enum FSM {
|
|||||||
FSM_PASSING,
|
FSM_PASSING,
|
||||||
FSM_SAFETY,
|
FSM_SAFETY,
|
||||||
FSM_PLAYENDED,
|
FSM_PLAYENDED,
|
||||||
FSM_GAMEOVER
|
FSM_GAMEOVER,
|
||||||
}fsm;
|
FSM_TURNOVER,
|
||||||
|
FSM_OUTPLAY
|
||||||
|
};
|
||||||
|
|
||||||
|
static enum FSM fsm, nextFsm;
|
||||||
|
|
||||||
typedef void (*FSMFCN)();
|
typedef void (*FSMFCN)();
|
||||||
|
|
||||||
@ -307,16 +307,99 @@ static FSMFCN fsmfcn[] = {
|
|||||||
fsmPassing,
|
fsmPassing,
|
||||||
fsmSafety,
|
fsmSafety,
|
||||||
fsmPlayEnded,
|
fsmPlayEnded,
|
||||||
fsmGameOver
|
fsmGameOver,
|
||||||
|
fsmTurnover,
|
||||||
|
fsmOutPlay
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void InitGame()
|
||||||
|
{
|
||||||
|
bHomeTeam = FALSE;
|
||||||
|
PlatformSetInput(bHomeTeam);
|
||||||
|
|
||||||
|
nHScore = 0;
|
||||||
|
nVScore = 0;
|
||||||
|
fGameTime = 15.0;
|
||||||
|
nDown = -1;
|
||||||
|
nQuarter = 0;
|
||||||
|
nCurrentYardline = 35;
|
||||||
|
|
||||||
// proto's
|
bDisplayScore = FALSE;
|
||||||
static void InitGame();
|
bDisplayTime = TRUE;
|
||||||
static void DrawBlips();
|
bDisplayYard = FALSE;
|
||||||
static void EraseBlips();
|
bDisplayDown = FALSE;
|
||||||
|
bDisplayBlips = TRUE;
|
||||||
|
|
||||||
|
fsm = FSM_KICKOFFWAIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawBlips()
|
||||||
|
{
|
||||||
|
int x, y, nBright;
|
||||||
|
static BOOL blink = FALSE;
|
||||||
|
|
||||||
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
|
if (player[i].nBright != BLIP_OFF){
|
||||||
|
x = player[i].nColumn % 10;
|
||||||
|
y = player[i].nLane;
|
||||||
|
nBright = player[i].nBright;
|
||||||
|
Blips[x][y] = nBright;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (receiver.nBright != BLIP_OFF){
|
||||||
|
x = receiver.nColumn % 10;
|
||||||
|
y = receiver.nLane;
|
||||||
|
nBright = receiver.nBright;
|
||||||
|
Blips[x][y] = nBright;
|
||||||
|
}
|
||||||
|
if (ball.nBright != BLIP_OFF){
|
||||||
|
x = ball.nColumn % 10;
|
||||||
|
y = ball.nLane;
|
||||||
|
nBright = ball.nBright;
|
||||||
|
Blips[x][y] = nBright;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the blips field
|
||||||
|
for (y = 0; y < FOOTBALL2_BLIP_ROWS; y++){
|
||||||
|
for (x = 0; x < FOOTBALL2_BLIP_COLUMNS; x++){
|
||||||
|
|
||||||
|
switch(Blips[x][y]){
|
||||||
|
case BLIP_OFF:
|
||||||
|
case BLIP_DIM:
|
||||||
|
case BLIP_BRIGHT:
|
||||||
|
Football2_DrawBlip(Blips[x][y], x, y);
|
||||||
|
break;
|
||||||
|
case BLIP_DIMBLINK:
|
||||||
|
if (!blink){
|
||||||
|
Football2_DrawBlip(BLIP_DIM, x, y);
|
||||||
|
} else {
|
||||||
|
Football2_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BLIP_BRIGHTBLINK:
|
||||||
|
if (blink){
|
||||||
|
Football2_DrawBlip(BLIP_BRIGHT, x, y);
|
||||||
|
} else {
|
||||||
|
Football2_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blink = !blink;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EraseBlips()
|
||||||
|
{
|
||||||
|
// erase the blips field
|
||||||
|
for (int y = 0; y < FOOTBALL2_BLIP_ROWS; y++){
|
||||||
|
for (int x = 0; x < FOOTBALL2_BLIP_COLUMNS; x++){
|
||||||
|
Football2_DrawBlip(BLIP_OFF, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Football2_GetPower()
|
int Football2_GetPower()
|
||||||
{
|
{
|
||||||
@ -339,36 +422,11 @@ void Football2_PowerOff()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Football2_SetSkill(int i){
|
void Football2_SetSkill(int i){
|
||||||
if (i == 0){
|
nLevel = i;
|
||||||
bPro2 = FALSE;
|
|
||||||
} else {
|
|
||||||
bPro2 = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Football2_GetSkill(){
|
int Football2_GetSkill(){
|
||||||
return bPro2 ? 1 : 0;
|
return nLevel;
|
||||||
}
|
|
||||||
|
|
||||||
void InitGame()
|
|
||||||
{
|
|
||||||
bHomeTeam = FALSE;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
|
|
||||||
nHScore = 0;
|
|
||||||
nVScore = 0;
|
|
||||||
fGameTime = 15.0;
|
|
||||||
nDown = -1;
|
|
||||||
nQuarter = 0;
|
|
||||||
nCurrentYardline = 35;
|
|
||||||
|
|
||||||
bDisplayScore = FALSE;
|
|
||||||
bDisplayTime = TRUE;
|
|
||||||
bDisplayYard = FALSE;
|
|
||||||
bDisplayDown = FALSE;
|
|
||||||
bDisplayBlips = TRUE;
|
|
||||||
|
|
||||||
fsm = FSM_KICKOFFWAIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Football2_Run(int tu)
|
void Football2_Run(int tu)
|
||||||
@ -432,75 +490,20 @@ void Football2_Run(int tu)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBlips()
|
|
||||||
{
|
|
||||||
int x, y, nBright;
|
|
||||||
static BOOL blink = FALSE;
|
|
||||||
|
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
|
||||||
if (player[i].nBright != BLIP_OFF){
|
|
||||||
x = player[i].nColumn % 10;
|
|
||||||
y = player[i].nLane;
|
|
||||||
nBright = player[i].nBright;
|
|
||||||
Blips[x][y] = nBright;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (receiver.nBright != BLIP_OFF){
|
|
||||||
x = receiver.nColumn % 10;
|
|
||||||
y = receiver.nLane;
|
|
||||||
nBright = receiver.nBright;
|
|
||||||
Blips[x][y] = nBright;
|
|
||||||
}
|
|
||||||
if (ball.nBright != BLIP_OFF){
|
|
||||||
x = ball.nColumn % 10;
|
|
||||||
y = ball.nLane;
|
|
||||||
nBright = ball.nBright;
|
|
||||||
Blips[x][y] = nBright;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw the blips field
|
|
||||||
for (y = 0; y < FOOTBALL2_BLIP_ROWS; y++){
|
|
||||||
for (x = 0; x < FOOTBALL2_BLIP_COLUMNS; x++){
|
|
||||||
|
|
||||||
switch(Blips[x][y]){
|
|
||||||
case BLIP_OFF:
|
|
||||||
case BLIP_DIM:
|
|
||||||
case BLIP_BRIGHT:
|
|
||||||
Football2_DrawBlip(Blips[x][y], x, y);
|
|
||||||
break;
|
|
||||||
case BLIP_DIMBLINK:
|
|
||||||
if (!blink){
|
|
||||||
Football2_DrawBlip(BLIP_DIM, x, y);
|
|
||||||
} else {
|
|
||||||
Football2_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BLIP_BRIGHTBLINK:
|
|
||||||
if (blink){
|
|
||||||
Football2_DrawBlip(BLIP_BRIGHT, x, y);
|
|
||||||
} else {
|
|
||||||
Football2_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
blink = !blink;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EraseBlips()
|
|
||||||
{
|
|
||||||
// erase the blips field
|
|
||||||
for (int y = 0; y < FOOTBALL2_BLIP_ROWS; y++){
|
|
||||||
for (int x = 0; x < FOOTBALL2_BLIP_COLUMNS; x++){
|
|
||||||
Football2_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FINITE STATE MACHINE STUFF
|
// FINITE STATE MACHINE STUFF
|
||||||
|
static void fsmTurnover()
|
||||||
|
{
|
||||||
|
bHomeTeam = !bHomeTeam;
|
||||||
|
PlatformSetInput(bHomeTeam);
|
||||||
|
fsm = nextFsm;
|
||||||
|
nextFsm = FSM_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void fsmOutPlay()
|
||||||
|
{
|
||||||
|
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
|
fsm = FSM_PLAYENDED;
|
||||||
|
}
|
||||||
|
|
||||||
static void fsmKickoffWait()
|
static void fsmKickoffWait()
|
||||||
{
|
{
|
||||||
@ -792,20 +795,16 @@ static void fsmKickoffRunback()
|
|||||||
Football2_ClearScreen();
|
Football2_ClearScreen();
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_TOUCHDOWN, PLAYSOUNDFLAGS_PRIORITY);
|
Football2_PlaySound(FOOTBALL2_SOUND_TOUCHDOWN, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nCurrentYardline = 35;
|
nCurrentYardline = 35;
|
||||||
fsm = FSM_KICKOFFWAIT;
|
nextFsm = FSM_KICKOFFWAIT;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check for collisions
|
// check for collisions
|
||||||
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
||||||
// tackled!
|
// tackled!
|
||||||
Football2_ClearScreen();
|
Football2_ClearScreen();
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
|
||||||
|
|
||||||
int i = GETPLAYERAT(ball.nColumn, ball.nLane);
|
int i = GETPLAYERAT(ball.nColumn, ball.nLane);
|
||||||
if (i != -1){
|
if (i != -1){
|
||||||
SETPLAYERBRIGHTNESS(player[i], BLIP_DIMBLINK);
|
SETPLAYERBRIGHTNESS(player[i], BLIP_DIMBLINK);
|
||||||
@ -817,13 +816,13 @@ static void fsmKickoffRunback()
|
|||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
fsm = FSM_PLAYENDED;
|
fsm = FSM_OUTPLAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// move the defense randomly towards the ball
|
// move the defense randomly towards the ball
|
||||||
if (Platform_Random(100) < ((bPro2) ? 25 : 15)){
|
if (Platform_Random(100) < ((nLevel%2) ? 25 : 15)){
|
||||||
int i = Platform_Random(NUM_DEFENSEPLAYERS);
|
int i = Platform_Random(NUM_DEFENSEPLAYERS);
|
||||||
if (player[i].nBright){
|
if (player[i].nBright){
|
||||||
// pick horizontal or vertical movement toward the ball
|
// pick horizontal or vertical movement toward the ball
|
||||||
@ -875,7 +874,6 @@ static void fsmKickoffRunback()
|
|||||||
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
||||||
// tackled!
|
// tackled!
|
||||||
Football2_ClearScreen();
|
Football2_ClearScreen();
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
|
||||||
|
|
||||||
int i = GETPLAYERAT(ball.nColumn, ball.nLane);
|
int i = GETPLAYERAT(ball.nColumn, ball.nLane);
|
||||||
if (i != -1){
|
if (i != -1){
|
||||||
@ -888,7 +886,7 @@ static void fsmKickoffRunback()
|
|||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
fsm = FSM_PLAYENDED;
|
fsm = FSM_OUTPLAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,9 +984,6 @@ static void fsmFormation()
|
|||||||
if (bChange)
|
if (bChange)
|
||||||
{
|
{
|
||||||
// punt
|
// punt
|
||||||
|
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nCurrentYardline = ball.nYard;
|
nCurrentYardline = ball.nYard;
|
||||||
@ -1006,7 +1001,8 @@ static void fsmFormation()
|
|||||||
SETPLAYERBRIGHTNESS(ball, BLIP_BRIGHTBLINK);
|
SETPLAYERBRIGHTNESS(ball, BLIP_BRIGHTBLINK);
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
bPunting = TRUE;
|
bPunting = TRUE;
|
||||||
fsm = FSM_KICKOFFMIDAIR;
|
nextFsm = FSM_KICKOFFMIDAIR;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1091,8 +1087,6 @@ static void fsmInPlay()
|
|||||||
if (Football2_GetInputKICK(NULL) && bCanKick){
|
if (Football2_GetInputKICK(NULL) && bCanKick){
|
||||||
|
|
||||||
// field goal attempt!
|
// field goal attempt!
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nKickoffStart = nCurrentYardline;
|
nKickoffStart = nCurrentYardline;
|
||||||
@ -1111,8 +1105,8 @@ static void fsmInPlay()
|
|||||||
SETPLAYERBRIGHTNESS(ball, BLIP_BRIGHTBLINK);
|
SETPLAYERBRIGHTNESS(ball, BLIP_BRIGHTBLINK);
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
bFieldGoalAttempt = TRUE;
|
bFieldGoalAttempt = TRUE;
|
||||||
fsm = FSM_KICKOFFMIDAIR;
|
nextFsm = FSM_KICKOFFMIDAIR;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,10 +1140,9 @@ static void fsmInPlay()
|
|||||||
Football2_ClearScreen();
|
Football2_ClearScreen();
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_TOUCHDOWN, PLAYSOUNDFLAGS_PRIORITY);
|
Football2_PlaySound(FOOTBALL2_SOUND_TOUCHDOWN, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nCurrentYardline = 35;
|
nCurrentYardline = 35;
|
||||||
fsm = FSM_KICKOFFWAIT;
|
nextFsm = FSM_KICKOFFWAIT;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1175,31 +1168,24 @@ static void fsmInPlay()
|
|||||||
fsm = FSM_SAFETY;
|
fsm = FSM_SAFETY;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if ((++nDown >= 4) && (!bGotFirstDown)){
|
}
|
||||||
|
if ((++nDown >= 4) && (!bGotFirstDown)){
|
||||||
// give the ball to the other team
|
// give the ball to the other team
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
nextFsm = FSM_PLAYENDED;
|
||||||
fsm = FSM_PLAYENDED;
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else {
|
fsm = FSM_OUTPLAY;
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
|
||||||
fsm = FSM_PLAYENDED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// move the defense randomly towards the ball
|
// move the defense randomly towards the ball
|
||||||
if (Platform_Random(100) < ((bPro2) ? 25 : 15)){
|
if (Platform_Random(100) < ((nLevel%2) ? 25 : 15)){
|
||||||
int i = Platform_Random(NUM_DEFENSEPLAYERS);
|
int i = Platform_Random(NUM_DEFENSEPLAYERS);
|
||||||
if (player[i].nBright){
|
if (player[i].nBright){
|
||||||
// pick horizontal or vertical movement toward the ball
|
// pick horizontal or vertical movement toward the ball
|
||||||
@ -1235,9 +1221,8 @@ static void fsmInPlay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// move the receiver randomly
|
// move the receiver randomly
|
||||||
if (Platform_Random(100) < ((bPro2) ? 15 : 5)){
|
if (Platform_Random(100) < ((nLevel%2) ? 15 : 5)){
|
||||||
if (receiver.nBright){
|
if (receiver.nBright){
|
||||||
// pick horizontal or vertical movement toward the ball
|
// pick horizontal or vertical movement toward the ball
|
||||||
if (Platform_Random(4) == 0){
|
if (Platform_Random(4) == 0){
|
||||||
@ -1268,7 +1253,6 @@ static void fsmInPlay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check for collisions again
|
// check for collisions again
|
||||||
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
||||||
// tackled!
|
// tackled!
|
||||||
@ -1291,28 +1275,21 @@ static void fsmInPlay()
|
|||||||
fsm = FSM_SAFETY;
|
fsm = FSM_SAFETY;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if ((++nDown >= 4) && (!bGotFirstDown)){
|
}
|
||||||
|
if ((++nDown >= 4) && (!bGotFirstDown)){
|
||||||
// give the ball to the other team
|
// give the ball to the other team
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
fsm = FSM_PLAYENDED;
|
nextFsm = FSM_PLAYENDED;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
fsm = FSM_OUTPLAY;
|
||||||
fsm = FSM_PLAYENDED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// count down the clock
|
// count down the clock
|
||||||
if (Platform_IsNewSecond()){
|
if (Platform_IsNewSecond()){
|
||||||
if (fGameTime > 0.0){
|
if (fGameTime > 0.0){
|
||||||
@ -1330,8 +1307,7 @@ static void fsmInPlay()
|
|||||||
|
|
||||||
static void fsmPassing()
|
static void fsmPassing()
|
||||||
{
|
{
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
BOOL bIntercepted = FALSE;
|
|
||||||
|
|
||||||
bDisplayTime = TRUE;
|
bDisplayTime = TRUE;
|
||||||
bDisplayScore = FALSE;
|
bDisplayScore = FALSE;
|
||||||
@ -1361,20 +1337,18 @@ BOOL bIntercepted = FALSE;
|
|||||||
if ((++nDown >= 4) && (!bGotFirstDown)){
|
if ((++nDown >= 4) && (!bGotFirstDown)){
|
||||||
|
|
||||||
// give the ball to the other team
|
// give the ball to the other team
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
Football2_PlaySound(FOOTBALL2_SOUND_ENDPOSSESSION, PLAYSOUNDFLAGS_PRIORITY);
|
||||||
|
nextFsm = FSM_PLAYENDED;
|
||||||
} else {
|
fsm = FSM_TURNOVER;
|
||||||
Football2_PlaySound(FOOTBALL2_SOUND_ENDPLAY, PLAYSOUNDFLAGS_PRIORITY);
|
}
|
||||||
|
else {
|
||||||
|
fsm = FSM_OUTPLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
fsm = FSM_PLAYENDED;
|
|
||||||
|
|
||||||
} else if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
} else if (ISDEFENSE(ball.nColumn, ball.nLane)){
|
||||||
|
|
||||||
@ -1399,14 +1373,13 @@ BOOL bIntercepted = FALSE;
|
|||||||
UNMOVEPLAYER(ball);
|
UNMOVEPLAYER(ball);
|
||||||
|
|
||||||
// give the ball to the other team
|
// give the ball to the other team
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
nDown = 0;
|
nDown = 0;
|
||||||
ball.nYard = MAX_YARD - ball.nYard;
|
ball.nYard = MAX_YARD - ball.nYard;
|
||||||
nFirstDownYard = ball.nYard - 10;
|
nFirstDownYard = ball.nYard - 10;
|
||||||
|
|
||||||
Platform_IsNewSecond();
|
Platform_IsNewSecond();
|
||||||
fsm = FSM_PLAYENDED;
|
nextFsm = FSM_PLAYENDED;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1459,8 +1432,6 @@ static void fsmSafety()
|
|||||||
++nQuarter;
|
++nQuarter;
|
||||||
if (nQuarter == 2){
|
if (nQuarter == 2){
|
||||||
// halftime - force kickoff
|
// halftime - force kickoff
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
ball.nYard = 35;
|
ball.nYard = 35;
|
||||||
nCurrentYardline = ball.nYard;
|
nCurrentYardline = ball.nYard;
|
||||||
nFirstDownYard = nCurrentYardline - 35;
|
nFirstDownYard = nCurrentYardline - 35;
|
||||||
@ -1473,11 +1444,11 @@ static void fsmSafety()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fGameTime = 15.0;
|
fGameTime = 15.0;
|
||||||
fsm = FSM_KICKOFFWAIT;
|
nextFsm = FSM_KICKOFFWAIT;
|
||||||
|
fsm = FSM_TURNOVER;
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
fGameTime = 15.0;
|
fGameTime = 15.0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add 2 points and set up kickoff from 20 yardline
|
// add 2 points and set up kickoff from 20 yardline
|
||||||
@ -1486,17 +1457,15 @@ static void fsmSafety()
|
|||||||
} else {
|
} else {
|
||||||
nHScore += 2;
|
nHScore += 2;
|
||||||
}
|
}
|
||||||
bHomeTeam = !bHomeTeam;
|
|
||||||
PlatformSetInput(bHomeTeam);
|
|
||||||
ball.nYard = 20;
|
ball.nYard = 20;
|
||||||
nCurrentYardline = ball.nYard;
|
nCurrentYardline = ball.nYard;
|
||||||
nFirstDownYard = nCurrentYardline - 10;
|
nFirstDownYard = nCurrentYardline - 10;
|
||||||
|
|
||||||
fsm = FSM_KICKOFFWAIT;
|
nextFsm = FSM_KICKOFFWAIT;
|
||||||
fsmKickoffWait();
|
fsm = FSM_TURNOVER;
|
||||||
|
// fsmKickoffWait();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fsmPlayEnded()
|
static void fsmPlayEnded()
|
||||||
@ -1554,7 +1523,15 @@ static void fsmGameOver()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LINE_STEP 20
|
||||||
|
void Football2_Debug(int f)
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
int y = 0;
|
||||||
|
Football2_GetSize(&w, &h);
|
||||||
|
|
||||||
|
debugPrintf(realx(w)+10, realy(y), 0xFFFFFFFF, "level =%d", nLevel);
|
||||||
|
y += LINE_STEP;
|
||||||
|
debugPrintf(realx(w)+10, realy(y), 0xFFFFFFFF, "fsm =%d", fsm);
|
||||||
|
y += LINE_STEP;
|
||||||
|
}
|
||||||
|
@ -45,23 +45,24 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define FOOTBALL2_BLIP_ROWS 3
|
#define FOOTBALL2_BLIP_ROWS 3
|
||||||
#define FOOTBALL2_BLIP_COLUMNS 10
|
#define FOOTBALL2_BLIP_COLUMNS 10
|
||||||
|
|
||||||
#define FOOTBALL2_SOUND_CHARGESTART 0
|
#define FOOTBALL2_SOUND_CHARGESTART 0
|
||||||
#define FOOTBALL2_SOUND_CHARGE 1
|
#define FOOTBALL2_SOUND_CHARGE 1
|
||||||
#define FOOTBALL2_SOUND_TICK 2
|
#define FOOTBALL2_SOUND_TICK 2
|
||||||
#define FOOTBALL2_SOUND_RUNBACK 3
|
#define FOOTBALL2_SOUND_RUNBACK 3
|
||||||
#define FOOTBALL2_SOUND_FIRSTDOWN 4
|
#define FOOTBALL2_SOUND_FIRSTDOWN 4
|
||||||
#define FOOTBALL2_SOUND_ENDPLAY 5
|
#define FOOTBALL2_SOUND_ENDPLAY 5
|
||||||
#define FOOTBALL2_SOUND_ENDPOSSESSION 6
|
#define FOOTBALL2_SOUND_ENDPOSSESSION 6
|
||||||
#define FOOTBALL2_SOUND_ENDQUARTER 7
|
#define FOOTBALL2_SOUND_ENDQUARTER 7
|
||||||
#define FOOTBALL2_SOUND_TOUCHDOWN 8
|
#define FOOTBALL2_SOUND_TOUCHDOWN 8
|
||||||
#define FOOTBALL2_SOUND_SAFETY 9
|
#define FOOTBALL2_SOUND_SAFETY 9
|
||||||
|
#define FOOTBALL2_SOUND_NSOUNDS 10
|
||||||
|
|
||||||
void Football2_Run();
|
void Football2_Run(int tu);
|
||||||
void Football2_SetSkill(int i);
|
void Football2_SetSkill(int i);
|
||||||
int Football2_GetSkill();
|
int Football2_GetSkill();
|
||||||
void Football2_PowerOn();
|
void Football2_PowerOn();
|
||||||
void Football2_PowerOff();
|
void Football2_PowerOff();
|
||||||
int Football2_GetPower();
|
int Football2_GetPower();
|
||||||
|
void Football2_Debug();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -138,18 +138,6 @@ static PLAYER defense[NUM_DEFENSEPLAYERS];
|
|||||||
p.nColumn++; \
|
p.nColumn++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISPUCK(int x, int y);
|
|
||||||
static BOOL ISPUCK(int x, int y)
|
|
||||||
{
|
|
||||||
if ((puck.nColumn == x)
|
|
||||||
&& (puck.nRow == y)
|
|
||||||
&& (puck.nBright)){
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL ISPLAYER(int x, int y);
|
|
||||||
static BOOL ISPLAYER(int x, int y)
|
static BOOL ISPLAYER(int x, int y)
|
||||||
{
|
{
|
||||||
if ((player.nColumn == x)
|
if ((player.nColumn == x)
|
||||||
@ -160,7 +148,6 @@ static BOOL ISPLAYER(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISDEFENSE(int x, int y);
|
|
||||||
static BOOL ISDEFENSE(int x, int y)
|
static BOOL ISDEFENSE(int x, int y)
|
||||||
{
|
{
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
@ -173,7 +160,6 @@ static BOOL ISDEFENSE(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ISOCCUPIED(int x, int y);
|
|
||||||
static BOOL ISOCCUPIED(int x, int y)
|
static BOOL ISOCCUPIED(int x, int y)
|
||||||
{
|
{
|
||||||
// easy way to keep player and defenders out of the non-playfield areas
|
// easy way to keep player and defenders out of the non-playfield areas
|
||||||
@ -197,8 +183,8 @@ static BOOL ISOCCUPIED(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GETPLAYERAT(int x, int y);
|
static int GETPLAYERAT(int x, int y)
|
||||||
static int GETPLAYERAT(int x, int y){
|
{
|
||||||
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
for (int i=0; i<NUM_DEFENSEPLAYERS; i++){
|
||||||
if ((defense[i].nColumn == x)
|
if ((defense[i].nColumn == x)
|
||||||
&& (defense[i].nRow == y)
|
&& (defense[i].nRow == y)
|
||||||
@ -233,7 +219,6 @@ static void fsmInPlay();
|
|||||||
static void fsmGoal();
|
static void fsmGoal();
|
||||||
static void fsmGameOver();
|
static void fsmGameOver();
|
||||||
|
|
||||||
|
|
||||||
static enum FSM {
|
static enum FSM {
|
||||||
FSM_PLAYSTARTWAIT=0,
|
FSM_PLAYSTARTWAIT=0,
|
||||||
FSM_SHOWSTATS,
|
FSM_SHOWSTATS,
|
||||||
@ -252,44 +237,7 @@ static FSMFCN fsmfcn[] = {
|
|||||||
fsmGameOver
|
fsmGameOver
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void InitGame()
|
||||||
// proto's
|
|
||||||
static void InitGame();
|
|
||||||
static void DrawBlips();
|
|
||||||
static void EraseBlips();
|
|
||||||
static BOOL PenaltyTest(int x, int y);
|
|
||||||
|
|
||||||
|
|
||||||
BOOL Hockey_GetPower()
|
|
||||||
{
|
|
||||||
return (bPower ? TRUE : FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hockey_PowerOn()
|
|
||||||
{
|
|
||||||
InitGame();
|
|
||||||
bPower = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hockey_PowerOff()
|
|
||||||
{
|
|
||||||
bPower = FALSE;
|
|
||||||
Hockey_StopSound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hockey_SetSkill(int i){
|
|
||||||
if (i == 0){
|
|
||||||
bPro2 = FALSE;
|
|
||||||
} else {
|
|
||||||
bPro2 = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Hockey_GetSkill(){
|
|
||||||
return bPro2 ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitGame()
|
|
||||||
{
|
{
|
||||||
bHomeTeam = FALSE;
|
bHomeTeam = FALSE;
|
||||||
PlatformSetInput(bHomeTeam);
|
PlatformSetInput(bHomeTeam);
|
||||||
@ -313,40 +261,7 @@ void InitGame()
|
|||||||
fsmShowStats();
|
fsmShowStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hockey_Run(int tu)
|
static void DrawBlips()
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
// prevent reentrancy
|
|
||||||
if (bInFrame){ return; }
|
|
||||||
bInFrame = TRUE;
|
|
||||||
|
|
||||||
// init the blips field
|
|
||||||
for (y = 0; y < HOCKEY_BLIP_ROWS; y++){
|
|
||||||
for (x = 0; x < HOCKEY_BLIP_COLUMNS; x++){
|
|
||||||
Blips[x][y] = BLIP_OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bPower){
|
|
||||||
Hockey_ClearScreen();
|
|
||||||
bInFrame = FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform_StartDraw();
|
|
||||||
|
|
||||||
(fsmfcn[fsm])();
|
|
||||||
|
|
||||||
DrawBlips();
|
|
||||||
|
|
||||||
Platform_EndDraw();
|
|
||||||
|
|
||||||
bInFrame = FALSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawBlips()
|
|
||||||
{
|
{
|
||||||
int x, y, nBright;
|
int x, y, nBright;
|
||||||
static BOOL bBlink = FALSE;
|
static BOOL bBlink = FALSE;
|
||||||
@ -416,20 +331,7 @@ void DrawBlips()
|
|||||||
bBlink = !bBlink;
|
bBlink = !bBlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EraseBlips()
|
static BOOL PenaltyTest(int x, int y)
|
||||||
{
|
|
||||||
// erase the blips field
|
|
||||||
for (int y = 1; y < HOCKEY_BLIP_ROWS; y++){
|
|
||||||
for (int x = 0; x < HOCKEY_BLIP_COLUMNS; x++){
|
|
||||||
Hockey_DrawBlip(BLIP_OFF, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// erase the blip behind the goal
|
|
||||||
Hockey_DrawBlip(BLIP_OFF, 2, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL PenaltyTest(int x, int y)
|
|
||||||
{
|
{
|
||||||
if (ISDEFENSE(x, y))
|
if (ISDEFENSE(x, y))
|
||||||
{
|
{
|
||||||
@ -466,6 +368,68 @@ BOOL PenaltyTest(int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL Hockey_GetPower()
|
||||||
|
{
|
||||||
|
return (bPower ? TRUE : FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hockey_PowerOn()
|
||||||
|
{
|
||||||
|
InitGame();
|
||||||
|
bPower = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hockey_PowerOff()
|
||||||
|
{
|
||||||
|
bPower = FALSE;
|
||||||
|
Hockey_StopSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hockey_SetSkill(int i){
|
||||||
|
if (i == 0){
|
||||||
|
bPro2 = FALSE;
|
||||||
|
} else {
|
||||||
|
bPro2 = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Hockey_GetSkill(){
|
||||||
|
return bPro2 ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hockey_Run(int tu)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
// prevent reentrancy
|
||||||
|
if (bInFrame){ return; }
|
||||||
|
bInFrame = TRUE;
|
||||||
|
|
||||||
|
// init the blips field
|
||||||
|
for (y = 0; y < HOCKEY_BLIP_ROWS; y++){
|
||||||
|
for (x = 0; x < HOCKEY_BLIP_COLUMNS; x++){
|
||||||
|
Blips[x][y] = BLIP_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bPower){
|
||||||
|
Hockey_ClearScreen();
|
||||||
|
bInFrame = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Platform_StartDraw();
|
||||||
|
|
||||||
|
(fsmfcn[fsm])();
|
||||||
|
|
||||||
|
DrawBlips();
|
||||||
|
|
||||||
|
Platform_EndDraw();
|
||||||
|
|
||||||
|
bInFrame = FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// FINITE STATE MACHINE STUFF
|
// FINITE STATE MACHINE STUFF
|
||||||
|
|
||||||
void fsmPlayStartWait()
|
void fsmPlayStartWait()
|
||||||
|
@ -53,8 +53,9 @@ Website : http://www.peterhirschberg.com
|
|||||||
#define HOCKEY_SOUND_STEAL 6
|
#define HOCKEY_SOUND_STEAL 6
|
||||||
#define HOCKEY_SOUND_ENDPERIOD 7
|
#define HOCKEY_SOUND_ENDPERIOD 7
|
||||||
#define HOCKEY_SOUND_ENDGAME 8
|
#define HOCKEY_SOUND_ENDGAME 8
|
||||||
|
#define HOCKEY_SOUND_NSOUNDS 9
|
||||||
|
|
||||||
void Hockey_Run();
|
void Hockey_Run(int tu);
|
||||||
void Hockey_SetSkill(int i);
|
void Hockey_SetSkill(int i);
|
||||||
int Hockey_GetSkill();
|
int Hockey_GetSkill();
|
||||||
void Hockey_PowerOn();
|
void Hockey_PowerOn();
|
||||||
|