-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjManager.h
96 lines (81 loc) · 2.34 KB
/
ObjManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- tab-width : 4 ; mode : C ; encode : ShiftJIS -*-
// このコードは、OBJマネージャーのヘッダファイル である。
//
#pragma once
#ifndef __OBJMANAGER_H__
#define __OBJMANAGER_H__
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <doslib.h>
#include <iocslib.h>
#include "CF_MACRO.h"
#include "types.h"
#include "GamePadManager.h"
#include "SceneManager.h"
#include "CMSprite.h"
// オブジェクトの最大数
#define OBJ_MAX 128
// オブジェクトIDの定義
enum
{
OBJ_ID_EMPTY = 0,
OBJ_ID_PLAYER,
OBJ_ID_PBULLET,
OBJ_ID_EBULLET,
OBJ_ID_ENEMY1,
OBJ_ID_ENEMY2,
OBJ_ID_ENEMY3,
OBJ_ID_EEFFECT,
OBJ_ID_PEFFECT,
OBJ_ID_MAX
};
// 構造体の定義
/// @brief オブジェクトの基本構造体
/// @note 128バイトになるようにパディングを入れている
typedef struct _tObj SObj;
typedef void (*ObjFuncPtr)(SObj *);
/// @brief オブジェクトの基本構造体
/// @note 全部のオブジェクトでこの構造体を使用する
struct _tObj
{
uint16 id; // オブジェクトID
int16 x; // X座標
int16 y; // Y座標
uint16 pat; // パターン番号
uint16 plane; // プレーン番号
int16 vx; // X方向
int16 vy; // Y方向
uint16 stat; // 移動状態 0=通常 1=下+方向転換
ObjFuncPtr Update; // 更新関数
ObjFuncPtr Draw; // 描画関数
uint16 anm_spd; // アニメーション速度
uint16 anm_num; // アニメーション枚数
uint16 anm_cou; // アニメーショタイミングカウンタ
uint16 anm_idx; // アニメーションインデックス
uint16 row; // 行数
uint16 col; // 列数
uint8 padding[128-36]; // 128バイトになるようにパディング
};
typedef SObj* pSObj;
extern pSObj g_pObj; // オブジェクトのポインタ
/////////////////////////////////
// OBJマネージャー:取得処理
/////////////////////////////////
/// @brief オブジェクトのポインタを取得する
/// @param i オブジェクトのインデックス
/// @retval オブジェクトのポインタ
FORCE_INLINE pSObj ObjManager_GetObj(int i)
{
return &g_pObj[i];
}
// プロトタイプ宣言
void OBJManager_Init();
pSObj ObjManager_Make(int id, int x, int y);
void ObjManager_Update();
void ObjManager_Draw();
void ObjManager_End();
void ObjManager_Destroy(pSObj pObj);
int ObjManager_FindEnemyIdx(void);
int ObjManager_FindEnemyNextIdx(int);
#endif // __OBJMANAGER_H__