mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
LAB: Simplify getViewData, get rid of ViewDataPtr and ActionPtr
This commit is contained in:
parent
f014218aca
commit
12f4a71c73
@ -665,7 +665,7 @@ static void mainGameLoop() {
|
||||
uint16 OldRoomNum, OldDirection = 0, GadID = 0, NewDir;
|
||||
|
||||
CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL;
|
||||
ViewDataPtr VPtr;
|
||||
ViewData *VPtr;
|
||||
|
||||
VGASetPal(initcolors, 8);
|
||||
|
||||
|
@ -51,7 +51,7 @@ void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum);
|
||||
|
||||
/* From ProcessRoom.c */
|
||||
|
||||
ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction);
|
||||
ViewData *getViewData(uint16 RoomNum, uint16 Direction);
|
||||
char *getPictName(CloseDataPtr *LCPtr);
|
||||
void drawDirection(CloseDataPtr LCPtr);
|
||||
bool processArrow(uint16 *Direction, uint16 Arrow);
|
||||
|
@ -110,15 +110,13 @@ typedef struct closeData {
|
||||
|
||||
typedef CloseData *CloseDataPtr;
|
||||
|
||||
struct viewData {
|
||||
struct ViewData {
|
||||
int16 *Condition;
|
||||
char *GraphicName;
|
||||
struct viewData *NextCondition;
|
||||
struct ViewData *NextCondition;
|
||||
CloseDataPtr closeUps;
|
||||
};
|
||||
|
||||
typedef viewData *ViewDataPtr;
|
||||
|
||||
|
||||
struct Action {
|
||||
int16 ActionType, Param1, Param2, Param3;
|
||||
@ -127,14 +125,11 @@ struct Action {
|
||||
Action *NextAction;
|
||||
};
|
||||
|
||||
typedef Action *ActionPtr;
|
||||
|
||||
|
||||
|
||||
struct Rule {
|
||||
int16 RuleType, Param1, Param2, *Condition;
|
||||
|
||||
ActionPtr ActionList;
|
||||
Action * ActionList;
|
||||
Rule *NextRule;
|
||||
};
|
||||
|
||||
@ -145,7 +140,7 @@ struct RoomData {
|
||||
|
||||
byte WipeType;
|
||||
|
||||
ViewDataPtr NorthView, SouthView, EastView, WestView;
|
||||
ViewData *NorthView, *SouthView, *EastView, *WestView;
|
||||
RuleList *rules;
|
||||
char *RoomMsg;
|
||||
};
|
||||
|
@ -94,40 +94,36 @@ static bool checkConditions(int16 *Condition) {
|
||||
/*****************************************************************************/
|
||||
/* Gets the current ViewDataPointer. */
|
||||
/*****************************************************************************/
|
||||
ViewDataPtr getViewData(uint16 roomNum, uint16 direction) {
|
||||
ViewDataPtr *VPtr = NULL, ViewPtr;
|
||||
bool doit = true;
|
||||
ViewData *getViewData(uint16 roomNum, uint16 direction) {
|
||||
ViewData *view = NULL;
|
||||
|
||||
if (direction == NORTH)
|
||||
VPtr = &Rooms[roomNum].NorthView;
|
||||
else if (direction == SOUTH)
|
||||
VPtr = &Rooms[roomNum].SouthView;
|
||||
else if (direction == EAST)
|
||||
VPtr = &Rooms[roomNum].EastView;
|
||||
else if (direction == WEST)
|
||||
VPtr = &Rooms[roomNum].WestView;
|
||||
|
||||
if (*VPtr == NULL)
|
||||
if (!Rooms[roomNum].RoomMsg)
|
||||
g_resource->readViews(roomNum);
|
||||
|
||||
ViewPtr = *VPtr;
|
||||
if (direction == NORTH)
|
||||
view = Rooms[roomNum].NorthView;
|
||||
else if (direction == SOUTH)
|
||||
view = Rooms[roomNum].SouthView;
|
||||
else if (direction == EAST)
|
||||
view = Rooms[roomNum].EastView;
|
||||
else if (direction == WEST)
|
||||
view = Rooms[roomNum].WestView;
|
||||
|
||||
do {
|
||||
if (checkConditions(ViewPtr->Condition))
|
||||
doit = false;
|
||||
else
|
||||
ViewPtr = ViewPtr->NextCondition;
|
||||
if (checkConditions(view->Condition))
|
||||
break;
|
||||
|
||||
} while (doit);
|
||||
view = view->NextCondition;
|
||||
} while (true);
|
||||
|
||||
return ViewPtr;
|
||||
return view;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Gets an object, if any, from the user's click on the screen. */
|
||||
/*****************************************************************************/
|
||||
static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) {
|
||||
ViewDataPtr VPtr;
|
||||
ViewData *VPtr;
|
||||
|
||||
if (LCPtr == NULL) {
|
||||
VPtr = getViewData(RoomNum, Direction);
|
||||
@ -179,7 +175,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) {
|
||||
/* Returns the current picture name. */
|
||||
/*****************************************************************************/
|
||||
char *getPictName(CloseDataPtr *LCPtr) {
|
||||
ViewDataPtr ViewPtr = getViewData(RoomNum, Direction);
|
||||
ViewData *ViewPtr = getViewData(RoomNum, Direction);
|
||||
|
||||
if (*LCPtr != NULL) {
|
||||
*LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps);
|
||||
@ -266,7 +262,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
|
||||
/* Sets the current close up data. */
|
||||
/*****************************************************************************/
|
||||
void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) {
|
||||
ViewDataPtr VPtr;
|
||||
ViewData *VPtr;
|
||||
CloseDataPtr LCPtr;
|
||||
uint16 x1, y1, x2, y2;
|
||||
|
||||
@ -302,7 +298,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords)
|
||||
/* Takes the currently selected item. */
|
||||
/*****************************************************************************/
|
||||
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
|
||||
ViewDataPtr VPtr;
|
||||
ViewData *VPtr;
|
||||
CloseDataPtr LCPtr;
|
||||
|
||||
if (*cptr == NULL) {
|
||||
@ -332,7 +328,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
|
||||
/*****************************************************************************/
|
||||
/* Processes the action list. */
|
||||
/*****************************************************************************/
|
||||
static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
|
||||
static void doActions(Action * APtr, CloseDataPtr *LCPtr) {
|
||||
CloseDataPtr TLCPtr;
|
||||
bool FirstLoaded = true;
|
||||
char **str, *Test;
|
||||
|
@ -283,17 +283,17 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) {
|
||||
return head;
|
||||
}
|
||||
|
||||
viewData *Resource::readView(Common::File *file) {
|
||||
ViewData *Resource::readView(Common::File *file) {
|
||||
char c;
|
||||
viewData *view = NULL;
|
||||
viewData *prev = NULL;
|
||||
viewData *head = NULL;
|
||||
ViewData *view = NULL;
|
||||
ViewData *prev = NULL;
|
||||
ViewData *head = NULL;
|
||||
|
||||
do {
|
||||
c = file->readByte();
|
||||
|
||||
if (c == 1) {
|
||||
view = (viewData *)malloc(sizeof(viewData));
|
||||
view = (ViewData *)malloc(sizeof(ViewData));
|
||||
if (!head)
|
||||
head = view;
|
||||
if (prev)
|
||||
|
@ -111,7 +111,7 @@ private:
|
||||
RuleList *readRule(Common::File *file);
|
||||
Action *readAction(Common::File *file);
|
||||
CloseData *readCloseUps(uint16 depth, Common::File *file);
|
||||
viewData *readView(Common::File *file);
|
||||
ViewData *readView(Common::File *file);
|
||||
void readStaticText();
|
||||
|
||||
Common::String _staticText[48];
|
||||
|
Loading…
x
Reference in New Issue
Block a user