diff options
Diffstat (limited to 'engines/hugo/route.cpp')
-rw-r--r-- | engines/hugo/route.cpp | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 9e068171a2..962adab45d 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -44,11 +44,13 @@ namespace Hugo { Route::Route(HugoEngine *vm) : _vm(vm) { } -// Face hero in new direction, based on cursor key input by user. +/** +* Face hero in new direction, based on cursor key input by user. +*/ void Route::setDirection(uint16 keyCode) { debugC(1, kDebugRoute, "setDirection(%d)", keyCode); - object_t *obj = _vm->_hero; // Pointer to hero object + object_t *obj = _vm->_hero; // Pointer to hero object // Set first image in sequence switch (keyCode) { @@ -79,15 +81,17 @@ void Route::setDirection(uint16 keyCode) { } } -// Set hero walking, based on cursor key input by user. -// Hitting same key twice will stop hero. +/** +* Set hero walking, based on cursor key input by user. +* Hitting same key twice will stop hero. +*/ void Route::setWalk(uint16 direction) { debugC(1, kDebugRoute, "setWalk(%d)", direction); static uint16 oldDirection = 0; // Last direction char - object_t *obj = _vm->_hero; // Pointer to hero object + object_t *obj = _vm->_hero; // Pointer to hero object - if (_vm->getGameStatus().storyModeFl || obj->pathType != USER) // Make sure user has control + if (_vm->getGameStatus().storyModeFl || obj->pathType != USER) // Make sure user has control return; if (!obj->vx && !obj->vy) @@ -142,20 +146,22 @@ void Route::setWalk(uint16 direction) { } } -// Recursive algorithm! Searches from hero to dest_x, dest_y -// Find horizontal line segment about supplied point and recursively -// find line segments for each point above and below that segment. -// When destination point found in segment, start surfacing and leave -// a trail in segment[] from destination back to hero. -// -// Note: there is a bug which allows a route through a 1-pixel high -// narrow gap if between 2 segments wide enough for hero. To work -// around this, make sure any narrow gaps are 2 or more pixels high. -// An example of this was the blocking guard in Hugo1/Dead-End. +/** +* Recursive algorithm! Searches from hero to dest_x, dest_y +* Find horizontal line segment about supplied point and recursively +* find line segments for each point above and below that segment. +* When destination point found in segment, start surfacing and leave +* a trail in segment[] from destination back to hero. +* +* Note: there is a bug which allows a route through a 1-pixel high +* narrow gap if between 2 segments wide enough for hero. To work +* around this, make sure any narrow gaps are 2 or more pixels high. +* An example of this was the blocking guard in Hugo1/Dead-End. +*/ void Route::segment(int16 x, int16 y) { debugC(1, kDebugRoute, "segment(%d, %d)", x, y); -// Note use of static - can't waste stack + // Note: use of static - can't waste stack static image_pt p; // Ptr to _boundaryMap[y] static segment_t *seg_p; // Ptr to segment @@ -262,8 +268,10 @@ void Route::segment(int16 x, int16 y) { } } -// Create and return ptr to new node. Initialize with previous node. -// Returns 0 if MAX_NODES exceeded +/** +* Create and return ptr to new node. Initialize with previous node. +* Returns 0 if MAX_NODES exceeded +*/ Point *Route::newNode() { debugC(1, kDebugRoute, "newNode"); @@ -274,10 +282,12 @@ Point *Route::newNode() { return &_route[_routeListIndex]; } -// Construct route to cx, cy. Return TRUE if successful. -// 1. Copy boundary bitmap to local byte map (include object bases) -// 2. Construct list of segments segment[] from hero to destination -// 3. Compress to shortest route in route[] +/** +* Construct route to cx, cy. Return TRUE if successful. +* 1. Copy boundary bitmap to local byte map (include object bases) +* 2. Construct list of segments segment[] from hero to destination +* 3. Compress to shortest route in route[] +*/ bool Route::findRoute(int16 cx, int16 cy) { debugC(1, kDebugRoute, "findRoute(%d, %d)", cx, cy); @@ -383,7 +393,9 @@ bool Route::findRoute(int16 cx, int16 cy) { return true; } -// Process hero in route mode - called from Move_objects() +/** +* Process hero in route mode - called from Move_objects() +*/ void Route::processRoute() { debugC(1, kDebugRoute, "processRoute"); @@ -454,9 +466,11 @@ void Route::processRoute() { } } -// Start a new route from hero to cx, cy -// go_for is the purpose, id indexes the exit or object to walk to -// Returns FALSE if route not found +/** +* Start a new route from hero to cx, cy +* go_for is the purpose, id indexes the exit or object to walk to +* Returns FALSE if route not found +*/ bool Route::startRoute(go_t go_for, int16 id, int16 cx, int16 cy) { debugC(1, kDebugRoute, "startRoute(%d, %d, %d, %d)", go_for, id, cx, cy); |