📄 games_cargador_path.c
字号:
#ifdef __cplusplus
extern "C" {
#endif
/*==================================================================================================
MODULE NAME : GAMES_Cargador_path.c
GENERAL DESCRIPTION
Input Short Message content.
SEF Confidential Proprietary
(c) Copyright 2002 by SEF Corp. All Rights Reserved.
====================================================================================================
Revision History
Modification Tracking
Date Author Number Description of changes
---------- -------------- --------- -----------------------------------------------------------------------------------
10/28/2003 lixingbo crxxxxx Initail creation
02/24/2004 lixingbo p002467 Modify the game for dolphin.
Self-documenting Code
Describe/explain low-level design of this module and/or group of funtions and/or specific
funtion that are hard to understand by reading code and thus requires detail description.
Free format !
====================================================================================================
INCLUDE FILES
==================================================================================================*/
#include "APP_include.h"
#include "TP_Operator.h"
#include "MENU_main.h"
#include "MENU_item.h"
#include "GAMES_main.h"
#include "GAMES_cargador_path.h"
#ifdef GAMES_CARGADOR
#include <stdlib.h>
#include "uhapi.h"
#include "SP_volume.h"
#include "SP_audio.h"
#include "GAMES_cargador.h"
#include "product.h"
/*==================================================================================================
LOCAL MACROS
==================================================================================================*/
#define ROAD_WHITE 0
#define GUY_SEAT_ONE 1
#define ROAD_YELLOW 2
#define GUY_SEAT_TWO 3
//#define SQUARELENGTH 16
#define RECTWIDTH 22
#define RECTHEIGHT 20
#ifdef PACIFIC_VERSION
#define rowNum 10
#else
#define rowNum 9
#endif
#define colNum (LCD_MAX_X / RECTWIDTH)
/*==================================================================================================
GLOBAL VARIABLES
==================================================================================================*/
extern OP_UINT8 Current_Box[rowNum][colNum];
PathElem CargadorPath[rowNum*colNum]={0};
OP_INT8 CargadorCurPath = rowNum*colNum;
/*==================================================================================================
LOCAL VARIABLES
==================================================================================================*/
static OP_BOOLEAN mark[rowNum][colNum]={OP_FALSE};
/*==================================================================================================
GLOBAL FUNCTION PROTOTYPES
==================================================================================================*/
OP_BOOLEAN SearchRoute(PosType start,PosType end);
/*==================================================================================================
LOCAL FUNCTION PROTOTYPES
==================================================================================================*/
static OP_BOOLEAN FootMark(PosType pos);
/*static BOOLEAN NextPos(PosType CurPos,OP_INT8 di,OP_INT8 choice,PosType *NextPosi);*/
static OP_INT8 GetChoice(PosType start,PosType end);
OP_INT8 GetDistance(PosType start,PosType end);
static OP_BOOLEAN Pass(PosType pos);
static OP_BOOLEAN Add(PathElem *Path,OP_INT8 CurPath, PathElem *Elem);
static OP_BOOLEAN Del(PathElem *Path,OP_INT8 CurPath,PathElem *Elem);
OP_BOOLEAN SearchRoute(PosType start,PosType end);
/*==================================================================================================
LOCAL FUNCTIONS
==================================================================================================*/
/*==================================================================================================
FUNCTION: FootMark
DESCRIPTION:
Description of this specific function.
ARGUMENTS PASSED:
RETURN VALUE:
IMPORTANT NOTES:
==================================================================================================*/
OP_BOOLEAN FootMark(PosType pos)
{
if(mark[pos.y][pos.x] == OP_FALSE)
{
mark[pos.y][pos.x] = OP_TRUE;
}
else
{
mark[pos.y][pos.x] = OP_FALSE;
}
return OP_SUCCESS;
}
/* OP_BOOLEAN NextPos(PosType CurPos,OP_INT8 di,OP_INT8 choice,PosType *NextPosi)
{
op_memcpy(NextPosi,&CurPos,sizeof(PosType));
switch(di)
{
case 1:
NextPosi->x++;
break;
case 2:
NextPosi->y++;
break;
case 3:
NextPosi->x--;
break;
case 4:
NextPosi->y--;
break;
default:
break;
}
return OP_SUCCESS;
}*/
/* choice == 1 :x+,y+,x-,y-.
choice == 2 :x+,y-,x-,y+
choice == 3 :x-,y+,x+,y-
choice == 4 :x-,y-,x+,y+*/
/*==================================================================================================
FUNCTION: NextPos
DESCRIPTION:
Description of this specific function.
ARGUMENTS PASSED:
RETURN VALUE:
IMPORTANT NOTES:
==================================================================================================*/
static OP_BOOLEAN NextPos(PosType CurPos,OP_INT8 di,OP_INT8 choice,PosType *NextPosi)
{
op_memcpy(NextPosi,&CurPos,sizeof(PosType));
switch(choice)
{
case 1:
switch(di)
{
case 1:
NextPosi->x++;
break;
case 2:
NextPosi->y++;
break;
case 3:
NextPosi->x--;
break;
case 4:
NextPosi->y--;
break;
default:
break;
}
break;
case 2:
switch(di)
{
case 1:
NextPosi->y++;
break;
case 2:
NextPosi->x++;
break;
case 3:
NextPosi->y--;
break;
case 4:
NextPosi->x--;
break;
default:
break;
}
break;
case 3:
switch(di)
{
case 1:
NextPosi->x++;
break;
case 2:
NextPosi->y--;
break;
case 3:
NextPosi->x--;
break;
case 4:
NextPosi->y++;
break;
default:
break;
}
break;
case 4:
switch(di)
{
case 1:
NextPosi->y--;
break;
case 2:
NextPosi->x++;
break;
case 3:
NextPosi->y++;
break;
case 4:
NextPosi->x--;
break;
default:
break;
}
break;
case 5:
switch(di)
{
case 1:
NextPosi->x--;
break;
case 2:
NextPosi->y++;
break;
case 3:
NextPosi->x++;
break;
case 4:
NextPosi->y--;
break;
default:
break;
}
break;
case 6:
switch(di)
{
case 1:
NextPosi->y++;
break;
case 2:
NextPosi->x--;
break;
case 3:
NextPosi->y--;
break;
case 4:
NextPosi->x++;
break;
default:
break;
}
break;
case 7:
switch(di)
{
case 1:
NextPosi->x--;
break;
case 2:
NextPosi->y--;
break;
case 3:
NextPosi->x++;
break;
case 4:
NextPosi->y++;
break;
default:
break;
}
break;
case 8:
switch(di)
{
case 1:
NextPosi->y--;
break;
case 2:
NextPosi->x--;
break;
case 3:
NextPosi->y++;
break;
case 4:
NextPosi->x++;
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -