diff --git a/src/actarrow.cpp b/src/actarrow.cpp index 110beecc3..df4ba0aa6 100644 --- a/src/actarrow.cpp +++ b/src/actarrow.cpp @@ -37,7 +37,7 @@ #define ARROW_OLDY my->fskill[3] #define ARROW_MAXLIFE 600 -void actArrow(Entity* my) +bool actArrow(Entity* my) { double dist; int damage; @@ -57,7 +57,7 @@ void actArrow(Entity* my) if ( ARROW_LIFE >= ARROW_MAXLIFE ) { list_RemoveNode(my->mynode); - return; + return false; } if ( !ARROW_STUCK ) @@ -97,7 +97,7 @@ void actArrow(Entity* my) if ( parent && parent->checkFriend(hit.entity) ) { list_RemoveNode(my->mynode); - return; + return false; } } @@ -341,4 +341,6 @@ void actArrow(Entity* my) } } } + + return true; } diff --git a/src/actarrowtrap.cpp b/src/actarrowtrap.cpp index a31094715..cddcb69a7 100644 --- a/src/actarrowtrap.cpp +++ b/src/actarrowtrap.cpp @@ -28,7 +28,7 @@ #define ARROWTRAP_FIRED my->skill[0] #define ARROWTRAP_AMBIENCE my->skill[6] -void actArrowTrap(Entity* my) +bool actArrowTrap(Entity* my) { int x, y; int c; @@ -40,12 +40,12 @@ void actArrowTrap(Entity* my) if ( !map.tiles[OBSTACLELAYER + checky * MAPLAYERS + checkx * MAPLAYERS * map.height] ) // wall { list_RemoveNode(my->mynode); - return; + return false; } if ( ARROWTRAP_FIRED == 1 ) // shot my piece, time to die. { list_RemoveNode(my->mynode); - return; + return false; } ARROWTRAP_AMBIENCE--; @@ -57,7 +57,7 @@ void actArrowTrap(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -111,4 +111,6 @@ void actArrowTrap(Entity* my) } } } + + return true; } diff --git a/src/actbeartrap.cpp b/src/actbeartrap.cpp index d480d8c3e..c4ab0229c 100644 --- a/src/actbeartrap.cpp +++ b/src/actbeartrap.cpp @@ -35,7 +35,7 @@ #define BEARTRAP_APPEARANCE my->skill[14] #define BEARTRAP_IDENTIFIED my->skill[15] -void actBeartrap(Entity* my) +bool actBeartrap(Entity* my) { int i; if ( my->sprite == 667 ) @@ -46,7 +46,7 @@ void actBeartrap(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } // undo beartrap @@ -79,14 +79,14 @@ void actBeartrap(Entity* my) entity->itemNotMovingClient = 1; messagePlayer(i, language[1300]); list_RemoveNode(my->mynode); - return; + return false; } } } if ( BEARTRAP_CAUGHT == 1 ) { - return; + return true; } // launch beartrap @@ -219,25 +219,27 @@ void actBeartrap(Entity* my) entity->pitch = my->pitch; entity->roll = PI; list_RemoveNode(my->mynode); + return false; } else { BEARTRAP_CAUGHT = 1; my->sprite = 667; serverUpdateEntitySkill(my, 0); + return true; } - return; } } } } } -void actBeartrapLaunched(Entity* my) +bool actBeartrapLaunched(Entity* my) { if ( my->ticks >= 200 ) { list_RemoveNode(my->mynode); - return; + return false; } + return true; } diff --git a/src/actboulder.cpp b/src/actboulder.cpp index 6f7789437..55bb07df2 100644 --- a/src/actboulder.cpp +++ b/src/actboulder.cpp @@ -301,7 +301,7 @@ int boulderCheckAgainstEntity(Entity* my, Entity* entity) -------------------------------------------------------------------------------*/ -void actBoulder(Entity* my) +bool actBoulder(Entity* my) { int i; @@ -337,7 +337,7 @@ void actBoulder(Entity* my) { boulderSokobanOnDestroy(true); } - return; + return false; } if ( !BOULDER_NOGROUND ) { @@ -357,7 +357,7 @@ void actBoulder(Entity* my) } if ( boulderCheckAgainstEntity(my, entity) ) { - return; + return true; } } } @@ -465,7 +465,7 @@ void actBoulder(Entity* my) } if ( boulderCheckAgainstEntity(my, entity) ) { - return; + return true; } } } @@ -651,7 +651,7 @@ void actBoulder(Entity* my) } if ( boulderCheckAgainstEntity(my, entity) ) { - return; + return true; } } } @@ -730,12 +730,13 @@ void actBoulder(Entity* my) { --BOULDER_BLOODTIME; } + return true; } #define BOULDERTRAP_FIRED my->skill[0] #define BOULDERTRAP_AMBIENCE my->skill[6] -void actBoulderTrap(Entity* my) +bool actBoulderTrap(Entity* my) { int x, y; int c; @@ -749,7 +750,7 @@ void actBoulderTrap(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -838,9 +839,10 @@ void actBoulderTrap(Entity* my) } } } + return true; } -void actBoulderTrapEast(Entity* my) +bool actBoulderTrapEast(Entity* my) { int x, y; int c; @@ -864,7 +866,7 @@ void actBoulderTrapEast(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -875,7 +877,7 @@ void actBoulderTrapEast(Entity* my) if ( my->boulderTrapPreDelay > 0 ) { --my->boulderTrapPreDelay; - return; + return true; } playSoundEntity(my, 150, 128); for ( c = 0; c < MAXPLAYERS; c++ ) @@ -926,9 +928,10 @@ void actBoulderTrapEast(Entity* my) } } } + return true; } -void actBoulderTrapSouth(Entity* my) +bool actBoulderTrapSouth(Entity* my) { int x, y; int c; @@ -952,7 +955,7 @@ void actBoulderTrapSouth(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -963,7 +966,7 @@ void actBoulderTrapSouth(Entity* my) if ( my->boulderTrapPreDelay > 0 ) { --my->boulderTrapPreDelay; - return; + return true; } playSoundEntity(my, 150, 128); for ( c = 0; c < MAXPLAYERS; c++ ) @@ -1014,9 +1017,10 @@ void actBoulderTrapSouth(Entity* my) } } } + return true; } -void actBoulderTrapWest(Entity* my) +bool actBoulderTrapWest(Entity* my) { int x, y; int c; @@ -1040,7 +1044,7 @@ void actBoulderTrapWest(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -1051,7 +1055,7 @@ void actBoulderTrapWest(Entity* my) if ( my->boulderTrapPreDelay > 0 ) { --my->boulderTrapPreDelay; - return; + return true; } playSoundEntity(my, 150, 128); for ( c = 0; c < MAXPLAYERS; c++ ) @@ -1103,9 +1107,10 @@ void actBoulderTrapWest(Entity* my) } } } + return true; } -void actBoulderTrapNorth(Entity* my) +bool actBoulderTrapNorth(Entity* my) { int x, y; int c; @@ -1129,7 +1134,7 @@ void actBoulderTrapNorth(Entity* my) if ( !my->skill[28] ) { - return; + return true; } // received on signal @@ -1140,7 +1145,7 @@ void actBoulderTrapNorth(Entity* my) if ( my->boulderTrapPreDelay > 0 ) { --my->boulderTrapPreDelay; - return; + return true; } playSoundEntity(my, 150, 128); for ( c = 0; c < MAXPLAYERS; c++ ) @@ -1191,6 +1196,7 @@ void actBoulderTrapNorth(Entity* my) } } } + return true; } void boulderSokobanOnDestroy(bool pushedOffLedge) diff --git a/src/actcampfire.cpp b/src/actcampfire.cpp index 96c3219eb..a58e2eac3 100644 --- a/src/actcampfire.cpp +++ b/src/actcampfire.cpp @@ -32,7 +32,7 @@ #define CAMPFIRE_INIT my->skill[4] #define CAMPFIRE_SOUNDTIME my->skill[5] -void actCampfire(Entity* my) +bool actCampfire(Entity* my) { Entity* entity; int i; @@ -132,4 +132,5 @@ void actCampfire(Entity* my) } } } + return true; } diff --git a/src/actchest.cpp b/src/actchest.cpp index 1cf0594e7..bc32d6b41 100644 --- a/src/actchest.cpp +++ b/src/actchest.cpp @@ -34,17 +34,17 @@ //chest->children->first is the chest's inventory. -void actChest(Entity* my) +bool actChest(Entity* my) { if ( !my ) { - return; + return false; } - my->actChest(); + return my->actChest(); } -void Entity::actChest() +bool Entity::actChest() { chestAmbience--; if ( chestAmbience <= 0 ) @@ -55,7 +55,7 @@ void Entity::actChest() if ( multiplayer == CLIENT ) { - return; + return true; } int i; @@ -550,7 +550,7 @@ void Entity::actChest() list_RemoveNode(parentEntity->mynode); // remove lid } list_RemoveNode(mynode); // remove me - return; + return false; } if ( chestStatus == 1 ) @@ -670,9 +670,10 @@ void Entity::actChest() playSoundEntity(this, 152, 64); } } + return true; } -void actChestLid(Entity* my) +bool actChestLid(Entity* my) { int i; @@ -680,7 +681,7 @@ void actChestLid(Entity* my) if ( !parent ) { list_RemoveNode(my->mynode); - return; + return false; } if ( multiplayer != CLIENT ) @@ -753,6 +754,7 @@ void actChestLid(Entity* my) } } } + return true; } void Entity::closeChest() @@ -1090,7 +1092,7 @@ void closeChestClientside() selectedChestSlot = -1; } -void addItemToChestClientside(Item* item) +bool addItemToChestClientside(Item* item) { if (openedChest[clientnum]) { @@ -1108,7 +1110,7 @@ void addItemToChestClientside(Item* item) if (!itemCompare(item, item2, false)) { item2->count += item->count; - return; + return true; } } @@ -1117,6 +1119,7 @@ void addItemToChestClientside(Item* item) item->node->deconstructor = &defaultDeconstructor; } //TODO: Else: Ruh-roh, error! + return true; } diff --git a/src/actdoor.cpp b/src/actdoor.cpp index d934e631e..1c48e4558 100644 --- a/src/actdoor.cpp +++ b/src/actdoor.cpp @@ -28,11 +28,11 @@ -------------------------------------------------------------------------------*/ -void actDoor(Entity* my) +bool actDoor(Entity* my) { if (!my) { - return; + return false; } Entity* entity; @@ -115,7 +115,7 @@ void actDoor(Entity* my) } playSoundEntity(my, 177, 64); list_RemoveNode(my->mynode); - return; + return false; } // using door @@ -262,9 +262,10 @@ void actDoor(Entity* my) } } } + return true; } -void actDoorFrame(Entity* my) +bool actDoorFrame(Entity* my) { // dummy function // intended to make it easier @@ -274,6 +275,7 @@ void actDoorFrame(Entity* my) { my->flags[PASSABLE] = true; // the actual frame should ALWAYS be passable } + return true; } void Entity::doorHandleDamageMagic(int damage, Entity &magicProjectile, Entity *caster) diff --git a/src/actflame.cpp b/src/actflame.cpp index 59a351804..300fcc9f9 100644 --- a/src/actflame.cpp +++ b/src/actflame.cpp @@ -28,17 +28,18 @@ #define FLAME_VELY my->vel_y #define FLAME_VELZ my->vel_z -void actFlame(Entity* my) +bool actFlame(Entity* my) { if ( FLAME_LIFE <= 0 ) { list_RemoveNode(my->mynode); - return; + return false; } my->x += FLAME_VELX; my->y += FLAME_VELY; my->z += FLAME_VELZ; FLAME_LIFE--; + return true; } /*------------------------------------------------------------------------------- diff --git a/src/actfountain.cpp b/src/actfountain.cpp index 3fa10c4c4..a3e130e04 100644 --- a/src/actfountain.cpp +++ b/src/actfountain.cpp @@ -36,7 +36,7 @@ -------------------------------------------------------------------------------*/ -void actFountain(Entity* my) +bool actFountain(Entity* my) { Entity* entity; @@ -88,7 +88,7 @@ void actFountain(Entity* my) // the rest of the function is server-side. if ( multiplayer == CLIENT ) { - return; + return true; } //Using the fountain (TODO: Monsters using it?). @@ -351,8 +351,9 @@ void actFountain(Entity* my) //TODO: messagePlayersInSight() instead. } //Then perform the effect randomly determined when the fountain was created. - return; + return true; } } } + return true; } diff --git a/src/actgate.cpp b/src/actgate.cpp index 2f675bb97..be808fc91 100644 --- a/src/actgate.cpp +++ b/src/actgate.cpp @@ -18,17 +18,17 @@ #include "collision.hpp" #include "player.hpp" -void actGate(Entity* my) +bool actGate(Entity* my) { if ( !my ) { - return; + return false; } - my->actGate(); + return my->actGate(); } -void Entity::actGate() +bool Entity::actGate() { int i; @@ -36,7 +36,7 @@ void Entity::actGate() { if ( circuit_status == 0 ) { - return; //Gate needs the mechanism powered state variable to be set. + return true; //Gate needs the mechanism powered state variable to be set. } if ( gateInverted == 0 ) @@ -197,4 +197,5 @@ void Entity::actGate() { this->flags[PASSABLE] = true; } + return true; } diff --git a/src/actgeneral.cpp b/src/actgeneral.cpp index 4d9c7d2ed..c85500203 100644 --- a/src/actgeneral.cpp +++ b/src/actgeneral.cpp @@ -27,7 +27,7 @@ -------------------------------------------------------------------------------*/ -void actAnimator(Entity* my) +bool actAnimator(Entity* my) { if ( my->skill[4] == 0 ) { @@ -38,7 +38,7 @@ void actAnimator(Entity* my) if ( (int)floor(my->x) < 0 || (int)floor(my->x) >= map.width || (int)floor(my->y) < 0 || (int)floor(my->y) >= map.height ) { list_RemoveNode(my->mynode); - return; + return false; } my->skill[3]++; @@ -53,11 +53,12 @@ void actAnimator(Entity* my) map.tiles[my->skill[0] + (int)floor(my->y)*MAPLAYERS + (int)floor(my->x)*MAPLAYERS * map.height] -= my->skill[1]; } } + return true; } #define TESTSPRITES -void actRotate(Entity* my) +bool actRotate(Entity* my) { my->yaw += 0.1; my->flags[PASSABLE] = true; // this entity should always be passable @@ -84,6 +85,7 @@ void actRotate(Entity* my) messagePlayer(clientnum, "test sprite: %d", my->sprite); } #endif + return true; } #define LIQUID_TIMER my->skill[0] @@ -91,12 +93,12 @@ void actRotate(Entity* my) #define LIQUID_LAVA my->flags[USERFLAG1] #define LIQUID_LAVANOBUBBLE my->skill[4] -void actLiquid(Entity* my) +bool actLiquid(Entity* my) { // as of 1.0.7 this function is DEPRECATED list_RemoveNode(my->mynode); - return; + return false; if ( !LIQUID_INIT ) { @@ -141,19 +143,21 @@ void actLiquid(Entity* my) } } } + return false; } -void actEmpty(Entity* my) +bool actEmpty(Entity* my) { // an empty action // used on clients to permit dead reckoning and other interpolation + return true; } -void actFurniture(Entity* my) +bool actFurniture(Entity* my) { if ( !my ) { - return; + return false; } if ( !my->flags[BURNABLE] ) @@ -161,10 +165,10 @@ void actFurniture(Entity* my) my->flags[BURNABLE] = true; } - my->actFurniture(); + return my->actFurniture(); } -void Entity::actFurniture() +bool Entity::actFurniture() { if ( !furnitureInit ) { @@ -226,7 +230,7 @@ void Entity::actFurniture() serverUpdateEntitySkill(entity, 19); } list_RemoveNode(mynode); - return; + return false; } // using @@ -270,12 +274,13 @@ void Entity::actFurniture() } } } + return true; } // an easter egg #define MCAXE_USED my->skill[0] -void actMCaxe(Entity* my) +bool actMCaxe(Entity* my) { my->yaw += .05; if ( my->yaw > PI * 2 ) @@ -317,82 +322,83 @@ void actMCaxe(Entity* my) if ( my->z > 64 ) { list_RemoveNode(my->mynode); - return; + return false; } } + return true; } -void actStalagFloor(Entity* my) +bool actStalagFloor(Entity* my) { //TODO: something? if ( !my ) { - return; + return false; } - my->actStalagFloor(); + return my->actStalagFloor(); } -void Entity::actStalagFloor() +bool Entity::actStalagFloor() { - + return true; } -void actStalagCeiling(Entity* my) +bool actStalagCeiling(Entity* my) { //TODO: something? if ( !my ) { - return; + return false; } - my->actStalagCeiling(); + return my->actStalagCeiling(); } -void Entity::actStalagCeiling() +bool Entity::actStalagCeiling() { - + return true; } -void actStalagColumn(Entity* my) +bool actStalagColumn(Entity* my) { //TODO: something? if ( !my ) { - return; + return false; } - my->actStalagColumn(); + return my->actStalagColumn(); } -void Entity::actStalagColumn() +bool Entity::actStalagColumn() { - + return true; } -void actColumn(Entity* my) +bool actColumn(Entity* my) { //TODO: something? if ( !my ) { - return; + return false; } if ( my->flags[BLOCKSIGHT] ) // stop the compiler optimising into a different entity. { my->flags[BLOCKSIGHT] = false; } - my->actColumn(); + return my->actColumn(); } -void Entity::actColumn() +bool Entity::actColumn() { - + return true; } -void actCeilingTile(Entity* my) +bool actCeilingTile(Entity* my) { if ( !my ) { - return; + return false; } if ( !my->flags[PASSABLE] ) { @@ -402,26 +408,28 @@ void actCeilingTile(Entity* my) { my->flags[BLOCKSIGHT] = false; } + return true; } -void actPistonBase(Entity* my) +bool actPistonBase(Entity* my) { if ( !my ) { - return; + return false; } + return true; } -void actPistonCam(Entity* my) +bool actPistonCam(Entity* my) { if ( !my ) { - return; + return false; } - my->actPistonCam(); + return my->actPistonCam(); } -void Entity::actPistonCam() +bool Entity::actPistonCam() { yaw += pistonCamRotateSpeed; while ( yaw > 2 * PI ) @@ -480,34 +488,36 @@ void Entity::actPistonCam() pistonCamDir = 0; // down } } + return true; } -void actFloorDecoration(Entity* my) +bool actFloorDecoration(Entity* my) { if ( !my ) { - return; + return false; } if ( !my->flags[PASSABLE] ) { my->flags[PASSABLE] = true; } + return true; } -void actTextSource(Entity* my) +bool actTextSource(Entity* my) { if ( !my ) { - return; + return false; } - my->actTextSource(); + return my->actTextSource(); } -void Entity::actTextSource() +bool Entity::actTextSource() { if ( multiplayer == CLIENT ) { - return; + return true; } if ( ((textSourceVariables4W >> 16) & 0xFFFF) == 0 ) // store the delay in the 16 leftmost bits. @@ -521,7 +531,7 @@ void Entity::actTextSource() if ( textSourceDelay > 0 ) { --textSourceDelay; - return; + return true; } else { @@ -590,4 +600,5 @@ void Entity::actTextSource() textSourceVariables4W -= 1; } } -} \ No newline at end of file + return true; +} diff --git a/src/actgib.cpp b/src/actgib.cpp index 159d0a2fa..427c71c1a 100644 --- a/src/actgib.cpp +++ b/src/actgib.cpp @@ -32,20 +32,20 @@ #define GIB_GRAVITY my->fskill[3] #define GIB_LIFESPAN my->skill[4] -void actGib(Entity* my) +bool actGib(Entity* my) { // don't update gibs that have no velocity if ( my->z == 8 && fabs(GIB_VELX) < .01 && fabs(GIB_VELY) < .01 ) { list_RemoveNode(my->mynode); - return; + return false; } // remove gibs that have exceeded their life span if ( my->ticks > GIB_LIFESPAN && GIB_LIFESPAN ) { list_RemoveNode(my->mynode); - return; + return false; } // horizontal motion @@ -91,8 +91,9 @@ void actGib(Entity* my) if ( my->z > 128 ) { list_RemoveNode(my->mynode); - return; + return false; } + return true; } /*------------------------------------------------------------------------------- diff --git a/src/actgold.cpp b/src/actgold.cpp index d4ac6e08b..7d12a3123 100644 --- a/src/actgold.cpp +++ b/src/actgold.cpp @@ -27,7 +27,7 @@ -------------------------------------------------------------------------------*/ -void actGoldBag(Entity* my) +bool actGoldBag(Entity* my) { int i; @@ -41,7 +41,7 @@ void actGoldBag(Entity* my) Entity* entity = (Entity*)node->element; if ( entity->sprite == 245 ) // boulder.vox { - return; + return true; } } my->flags[INVISIBLE] = false; @@ -56,7 +56,7 @@ void actGoldBag(Entity* my) } else { - return; + return true; } } @@ -107,7 +107,7 @@ void actGoldBag(Entity* my) // remove gold entity list_RemoveNode(my->mynode); - return; + return false; } } } @@ -116,4 +116,5 @@ void actGoldBag(Entity* my) { my->flags[NOUPDATE] = true; } + return true; } diff --git a/src/actheadstone.cpp b/src/actheadstone.cpp index 94073763f..a1c49fde4 100644 --- a/src/actheadstone.cpp +++ b/src/actheadstone.cpp @@ -34,7 +34,7 @@ #define HEADSTONE_MESSAGE my->skill[4] #define HEADSTONE_AMBIENCE my->skill[5] -void actHeadstone(Entity* my) +bool actHeadstone(Entity* my) { if ( my->flags[INVISIBLE] ) { @@ -57,7 +57,7 @@ void actHeadstone(Entity* my) } if ( goldbags >= 9 && artifact ) { - return; + return true; } my->flags[INVISIBLE] = false; my->flags[PASSABLE] = false; @@ -66,7 +66,7 @@ void actHeadstone(Entity* my) } else { - return; + return true; } } @@ -79,7 +79,7 @@ void actHeadstone(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } if ( !HEADSTONE_INIT ) @@ -136,4 +136,5 @@ void actHeadstone(Entity* my) } } } + return true; } diff --git a/src/acthudweapon.cpp b/src/acthudweapon.cpp index a9205100e..6630ee429 100644 --- a/src/acthudweapon.cpp +++ b/src/acthudweapon.cpp @@ -40,7 +40,7 @@ Sint32 pickaxeGimpTimer = 0; // player cannot swap weapons immediately after usi -------------------------------------------------------------------------------*/ -void actHudArm(Entity* my) +bool actHudArm(Entity* my) { hudarm = my; Entity* parent = hudweapon; @@ -49,21 +49,21 @@ void actHudArm(Entity* my) { hudarm = nullptr; list_RemoveNode(my->mynode); - return; + return false; } if (stats[clientnum]->HP <= 0) { hudarm = nullptr; list_RemoveNode(my->mynode); - return; + return false; } if (parent == nullptr) { hudarm = nullptr; list_RemoveNode(my->mynode); - return; + return false; } // sprite @@ -156,6 +156,7 @@ void actHudArm(Entity* my) //my->pitch = atan2( my->z-camera.z*.5, my->fskill[0] ); my->pitch = -17 * PI / 32; //messagePlayer(0, "my y: %f, my z: %f", my->y, my->z); + return true; } #ifdef USE_FMOD @@ -190,7 +191,7 @@ bool bowFire = false; #define HUDWEAPON_OLDVIBRATEZ my->fskill[8] Uint32 hudweaponuid = 0; -void actHudWeapon(Entity* my) +bool actHudWeapon(Entity* my) { double result = 0; ItemType type; @@ -202,7 +203,7 @@ void actHudWeapon(Entity* my) if ( intro == true ) { my->flags[INVISIBLE] = true; - return; + return true; } if ( multiplayer == CLIENT ) @@ -210,7 +211,7 @@ void actHudWeapon(Entity* my) if ( stats[clientnum]->HP <= 0 ) { my->flags[INVISIBLE] = true; - return; + return true; } } @@ -236,7 +237,7 @@ void actHudWeapon(Entity* my) { hudweapon = nullptr; //PLAYER DED. NULLIFY THIS. list_RemoveNode(my->mynode); - return; + return false; } // reduce throwGimpTimer (allows player to throw items again) @@ -275,7 +276,7 @@ void actHudWeapon(Entity* my) { parent->flags[INVISIBLE] = true; } - return; + return true; } } } @@ -519,7 +520,7 @@ void actHudWeapon(Entity* my) if ( achievementBrawlerMode && conductGameChallenges[CONDUCT_BRAWLER] ) { messagePlayer(clientnum, language[2997]); // prevent attack. - return; + return true; } if ( achievementBrawlerMode ) { @@ -1405,7 +1406,7 @@ void actHudWeapon(Entity* my) // move the weapon if (players[clientnum] == nullptr || players[clientnum]->entity == nullptr) { - return; + return true; } double defaultpitch = PI / 8.f; if (stats[clientnum]->weapon == nullptr) @@ -1456,6 +1457,7 @@ void actHudWeapon(Entity* my) } } } + return true; } #define HUDSHIELD_DEFEND my->skill[0] @@ -1467,7 +1469,7 @@ void actHudWeapon(Entity* my) #define HUDSHIELD_PITCH my->fskill[4] #define HUDSHIELD_ROLL my->fskill[5] -void actHudShield(Entity* my) +bool actHudShield(Entity* my) { my->flags[UNCLICKABLE] = true; @@ -1475,7 +1477,7 @@ void actHudShield(Entity* my) if (intro == true) { my->flags[INVISIBLE] = true; - return; + return true; } if (multiplayer == CLIENT) @@ -1483,7 +1485,7 @@ void actHudShield(Entity* my) if (stats[clientnum]->HP <= 0) { my->flags[INVISIBLE] = true; - return; + return true; } } @@ -1491,7 +1493,7 @@ void actHudShield(Entity* my) if (players[clientnum] == nullptr || players[clientnum]->entity == nullptr || !hudweapon) { list_RemoveNode(my->mynode); - return; + return false; } // check levitating value @@ -1793,4 +1795,5 @@ void actHudShield(Entity* my) } } } + return true; } diff --git a/src/actitem.cpp b/src/actitem.cpp index 5cfbd3f28..83dee48c9 100644 --- a/src/actitem.cpp +++ b/src/actitem.cpp @@ -41,7 +41,7 @@ #define ITEM_LIFE my->skill[16] #define ITEM_AMBIENCE my->skill[17] -void actItem(Entity* my) +bool actItem(Entity* my) { Item* item; int i; @@ -146,7 +146,7 @@ void actItem(Entity* my) } } my->clearMonsterInteract(); - return; + return true; } my->clearMonsterInteract(); } @@ -188,7 +188,7 @@ void actItem(Entity* my) } my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } @@ -218,12 +218,12 @@ void actItem(Entity* my) // let the client process some more gravity and make sure it isn't stopping early at an awkward angle. if ( my->itemNotMovingClient == 1 ) { - return; + return true; } } else { - return; + return true; } } @@ -311,7 +311,7 @@ void actItem(Entity* my) steamAchievementEntity(uidToEntity(my->parent), "BARONY_ACH_STFU"); } list_RemoveNode(my->mynode); - return; + return false; } // don't perform unneeded computations on items that have basically no velocity @@ -341,7 +341,7 @@ void actItem(Entity* my) { my->itemNotMovingClient = 1; } - return; + return true; } // horizontal motion @@ -379,4 +379,5 @@ void actItem(Entity* my) } ITEM_VELX = ITEM_VELX * .925; ITEM_VELY = ITEM_VELY * .925; + return true; } diff --git a/src/actladder.cpp b/src/actladder.cpp index 3d942352f..2227d81b9 100644 --- a/src/actladder.cpp +++ b/src/actladder.cpp @@ -32,7 +32,7 @@ #define LADDER_AMBIENCE my->skill[1] #define LADDER_SECRET my->skill[3] -void actLadder(Entity* my) +bool actLadder(Entity* my) { int playercount = 0; double dist; @@ -68,7 +68,7 @@ void actLadder(Entity* my) if (dist > TOUCHRANGE) { messagePlayer(i, language[505]); - return; + return true; } } if (playercount == 1) @@ -100,14 +100,15 @@ void actLadder(Entity* my) { secretlevel = (secretlevel == false); // toggle level lists } - return; + return true; } } } } + return true; } -void actLadderUp(Entity* my) +bool actLadderUp(Entity* my) { int i; @@ -128,14 +129,15 @@ void actLadderUp(Entity* my) if (inrange[i]) { messagePlayer(i, language[508]); - return; + return true; } } } } + return true; } -void actPortal(Entity* my) +bool actPortal(Entity* my) { int playercount = 0; double dist; @@ -170,7 +172,7 @@ void actPortal(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } // step through portal @@ -194,7 +196,7 @@ void actPortal(Entity* my) if (dist > TOUCHRANGE) { messagePlayer(i, language[505]); - return; + return true; } } if (playercount == 1) @@ -263,13 +265,14 @@ void actPortal(Entity* my) { secretlevel = (secretlevel == false); // toggle level lists } - return; + return true; } } } + return true; } -void actWinningPortal(Entity* my) +bool actWinningPortal(Entity* my) { int playercount = 0; double dist; @@ -283,7 +286,7 @@ void actWinningPortal(Entity* my) { if ( !(svFlags & SV_FLAG_CLASSIC) ) { - return; // classic mode disabled. + return true; // classic mode disabled. } } node_t* node; @@ -297,7 +300,7 @@ void actWinningPortal(Entity* my) { if ( stats->type == LICH || stats->type == DEVIL ) { - return; + return true; } } } @@ -341,7 +344,7 @@ void actWinningPortal(Entity* my) { if ( my->flags[INVISIBLE] ) { - return; + return true; } } @@ -363,7 +366,7 @@ void actWinningPortal(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } // step through portal @@ -387,7 +390,7 @@ void actWinningPortal(Entity* my) if (dist > TOUCHRANGE) { messagePlayer(i, language[509]); - return; + return true; } } victory = my->portalVictoryType; @@ -414,23 +417,24 @@ void actWinningPortal(Entity* my) { pauseGame(2, false); } - return; + return true; } } } + return true; } -void actExpansionEndGamePortal(Entity* my) +bool actExpansionEndGamePortal(Entity* my) { if ( !my ) { - return; + return false; } - my->actExpansionEndGamePortal(); + return my->actExpansionEndGamePortal(); } -void Entity::actExpansionEndGamePortal() +bool Entity::actExpansionEndGamePortal() { int playercount = 0; double dist; @@ -453,7 +457,7 @@ void Entity::actExpansionEndGamePortal() { if ( stats->type == LICH_FIRE || stats->type == LICH_ICE ) { - return; + return true; } } } @@ -481,7 +485,7 @@ void Entity::actExpansionEndGamePortal() { if ( flags[INVISIBLE] ) { - return; + return true; } } @@ -503,7 +507,7 @@ void Entity::actExpansionEndGamePortal() if ( multiplayer == CLIENT ) { - return; + return true; } // step through portal @@ -527,7 +531,7 @@ void Entity::actExpansionEndGamePortal() if ( dist > TOUCHRANGE ) { messagePlayer(i, language[509]); - return; + return true; } } victory = portalVictoryType; @@ -554,23 +558,24 @@ void Entity::actExpansionEndGamePortal() { pauseGame(2, false); } - return; + return true; } } } + return true; } -void actMidGamePortal(Entity* my) +bool actMidGamePortal(Entity* my) { if ( !my ) { - return; + return false; } - my->actMidGamePortal(); + return my->actMidGamePortal(); } -void Entity::actMidGamePortal() +bool Entity::actMidGamePortal() { int playercount = 0; double dist; @@ -584,7 +589,7 @@ void Entity::actMidGamePortal() { if ( (svFlags & SV_FLAG_CLASSIC) ) { - return; // classic mode enabled, don't process. + return true; // classic mode enabled, don't process. } } node_t* node; @@ -600,7 +605,7 @@ void Entity::actMidGamePortal() { if ( stats->type == LICH ) { - return; + return true; } } } @@ -640,7 +645,7 @@ void Entity::actMidGamePortal() { if ( flags[INVISIBLE] ) { - return; + return true; } } @@ -662,7 +667,7 @@ void Entity::actMidGamePortal() if ( multiplayer == CLIENT ) { - return; + return true; } // step through portal @@ -686,7 +691,7 @@ void Entity::actMidGamePortal() if ( dist > TOUCHRANGE ) { messagePlayer(i, language[509]); - return; + return true; } } //victory = portalVictoryType; @@ -712,8 +717,9 @@ void Entity::actMidGamePortal() pauseGame(2, false); } introstage = 9; // prepares mid game sequence - return; + return true; } } } -} \ No newline at end of file + return true; +} diff --git a/src/actmagictrap.cpp b/src/actmagictrap.cpp index 2a3f38ab6..5a7b484d0 100644 --- a/src/actmagictrap.cpp +++ b/src/actmagictrap.cpp @@ -29,18 +29,18 @@ The following function describes an entity behavior. The function takes a pointer to the entity that uses it as an argument. -------------------------------------------------------------------------------*/ -void actMagicTrapCeiling(Entity* my) +bool actMagicTrapCeiling(Entity* my) { if ( !my ) { - return; + return false; } - my->actMagicTrapCeiling(); + return my->actMagicTrapCeiling(); } -void Entity::actMagicTrapCeiling() +bool Entity::actMagicTrapCeiling() { spellTrapAmbience--; if ( spellTrapAmbience <= 0 ) @@ -51,13 +51,13 @@ void Entity::actMagicTrapCeiling() if ( multiplayer == CLIENT ) { - return; + return true; } if ( circuit_status != CIRCUIT_ON ) { spellTrapReset = 0; spellTrapCounter = spellTrapRefireRate; //shoost instantly! - return; + return true; } if ( !spellTrapInit ) @@ -154,6 +154,7 @@ void Entity::actMagicTrapCeiling() entity->actmagicIsVertical = MAGIC_ISVERTICAL_Z; } } + return true; } /*------------------------------------------------------------------------------- @@ -169,7 +170,7 @@ takes a pointer to the entity that uses it as an argument. #define MAGICTRAP_SPELL my->skill[1] #define MAGICTRAP_DIRECTION my->skill[3] -void actMagicTrap(Entity* my) +bool actMagicTrap(Entity* my) { if ( !MAGICTRAP_INIT ) { @@ -215,12 +216,12 @@ void actMagicTrap(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } if ( multiplayer == CLIENT ) { - return; + return true; } if ( my->ticks % TICKS_PER_SECOND == 0 ) @@ -268,4 +269,5 @@ void actMagicTrap(Entity* my) entity->vel_y = sin(entity->yaw) * (missile_speed); } } -} \ No newline at end of file + return true; +} diff --git a/src/actmonster.cpp b/src/actmonster.cpp index 495a86ce9..dd0da86c3 100644 --- a/src/actmonster.cpp +++ b/src/actmonster.cpp @@ -766,11 +766,11 @@ bool makeFollower(int monsterclicked, bool ringconflict, char namesays[32], Enti //int devilintro=0; -void actMonster(Entity* my) +bool actMonster(Entity* my) { if (!my) { - return; + return false; } int x, y, c, i; @@ -785,12 +785,13 @@ void actMonster(Entity* my) Stat* hitstats = NULL; bool hasrangedweapon = false; bool myReflex; + bool ret = true; Sint32 previousMonsterState = my->monsterState; // deactivate in menu if ( intro ) { - return; + return true; } // this is mostly a SERVER function. @@ -1081,7 +1082,7 @@ void actMonster(Entity* my) sendPacketSafe(net_sock, -1, net_packet, 0); } } - return; + return true; } if ( ticks % (TICKS_PER_SECOND) == my->getUID() % (TICKS_PER_SECOND / 2) ) @@ -1249,14 +1250,14 @@ void actMonster(Entity* my) node->element = myStats; node->deconstructor = &defaultDeconstructor;*/ - return; + return true; } myStats = my->getStats(); if ( myStats == NULL ) { printlog("ERROR: monster entity at %p has no stats struct!", my); - return; + return true; } myStats->defending = false; myStats->sneaking = 0; @@ -1314,6 +1315,7 @@ void actMonster(Entity* my) tempEntity->light = nullptr; } list_RemoveNode(tempEntity->mynode); + ret = false; } } if ( foundlights ) @@ -2044,6 +2046,7 @@ void actMonster(Entity* my) OPENAL_Channel_Stop(MONSTER_SOUND); } #endif + ret = false; myStats = my->getStats(); switch ( myStats->type ) { @@ -2185,7 +2188,7 @@ void actMonster(Entity* my) default: break; //This should never be reached. } - return; + return false; } if ( multiplayer != CLIENT ) @@ -2565,7 +2568,7 @@ void actMonster(Entity* my) my->z = -.25; } ghoulMoveBodyparts(my, myStats, 0); - return; + return true; } } @@ -2935,7 +2938,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } else if ( myStats->type == SHADOW && my->monsterTarget && my->monsterState != MONSTER_STATE_ATTACK ) { @@ -2944,7 +2947,7 @@ void actMonster(Entity* my) //my->monsterTargetX = my->monsterTarget.x; //my->monsterTargetY = my->monsterTarget.y; serverUpdateEntitySkill(my, 0); //Update monster state because it changed. - return; + return true; } } @@ -2996,7 +2999,7 @@ void actMonster(Entity* my) serverUpdateEntitySkill(my, 1); // update monsterTarget for player leaders. } } - return; + return true; } else { @@ -3043,7 +3046,7 @@ void actMonster(Entity* my) serverUpdateEntitySkill(my, 1); // update monsterTarget for player leaders. } } - return; + return true; } } } @@ -3209,7 +3212,7 @@ void actMonster(Entity* my) my->monsterState = MONSTER_STATE_WAIT; serverUpdateEntitySkill(my, 0); //Update state. } - return; + return true; } if ( entity != nullptr ) { @@ -3708,7 +3711,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } //Don't path if your target dieded! @@ -3720,7 +3723,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } entity = uidToEntity(my->monsterTarget); @@ -3759,7 +3762,7 @@ void actMonster(Entity* my) { //messagePlayer(0, "Shadow in special state teleport only! Aborting hunt state."); my->monsterState = MONSTER_STATE_WAIT; - return; //Don't do anything, yer casting a spell! + return true; //Don't do anything, yer casting a spell! } //Do the shadow's passive teleport to catch up to their target.. if ( myStats->type == SHADOW && my->monsterSpecialTimer == 0 && my->monsterTarget ) @@ -3770,7 +3773,7 @@ void actMonster(Entity* my) my->monsterReleaseAttackTarget(true); my->monsterState = MONSTER_STATE_WAIT; serverUpdateEntitySkill(my, 0); //Update state. - return; + return true; } //If shadow has no path to target, then should do the passive teleport. @@ -3812,7 +3815,7 @@ void actMonster(Entity* my) { messagePlayer(target->skill[2], language[2518]); } - return; + return true; } } @@ -4007,7 +4010,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } } else if ( myStats->type == SHADOW && my->monsterTarget && (ticks % 180 == 0) ) @@ -4021,7 +4024,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 1); // update monsterTarget for player leaders. } - return; + return true; } my->monsterState = MONSTER_STATE_PATH; serverUpdateEntitySkill(my, 0); //Update state. @@ -4029,7 +4032,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 1); // update monsterTarget for player leaders. } - return; + return true; } // lich cooldown @@ -4084,7 +4087,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } else { @@ -4128,7 +4131,7 @@ void actMonster(Entity* my) { serverUpdateEntitySkill(my, 0); } - return; + return true; } hit.entity = ohitentity; } @@ -5792,6 +5795,7 @@ void actMonster(Entity* my) lichIceAnimate(my, myStats, sqrt(MONSTER_VELX * MONSTER_VELX + MONSTER_VELY * MONSTER_VELY)); } } + return ret; } void Entity::handleMonsterAttack(Stat* myStats, Entity* target, double dist) @@ -8416,4 +8420,4 @@ bool Entity::monsterAllyEquipmentInClass(const Item& item) const } } return false; -} \ No newline at end of file +} diff --git a/src/actpedestal.cpp b/src/actpedestal.cpp index b83c18892..61320bb2e 100644 --- a/src/actpedestal.cpp +++ b/src/actpedestal.cpp @@ -30,27 +30,27 @@ takes a pointer to the entity that uses it as an argument. -------------------------------------------------------------------------------*/ -void actPedestalBase(Entity* my) +bool actPedestalBase(Entity* my) { if ( !my ) { - return; + return false; } - my->actPedestalBase(); + return my->actPedestalBase(); } -void actPedestalOrb(Entity* my) +bool actPedestalOrb(Entity* my) { if ( !my ) { - return; + return false; } - my->actPedestalOrb(); + return my->actPedestalOrb(); } -void Entity::actPedestalBase() +bool Entity::actPedestalBase() { node_t* node = children.first; Entity* orbEntity = (Entity*)(node->element); @@ -78,7 +78,7 @@ void Entity::actPedestalBase() { if ( this->ticks < 50 ) { - return; + return true; } // wait for external source to trigger the initialisation. if ( multiplayer != CLIENT ) @@ -94,7 +94,7 @@ void Entity::actPedestalBase() { if ( stats->type == LICH ) { - return; + return true; } } } @@ -102,7 +102,7 @@ void Entity::actPedestalBase() pedestalInit = 1; serverUpdateEntitySkill(this, 5); } - return; + return true; } if ( z > 4.5 ) @@ -142,7 +142,7 @@ void Entity::actPedestalBase() if ( multiplayer == CLIENT ) { - return; + return true; } if ( circuit_status < CIRCUIT_OFF ) @@ -309,9 +309,10 @@ void Entity::actPedestalBase() } } } + return true; } -void Entity::actPedestalOrb() +bool Entity::actPedestalOrb() { real_t upper_z = orbStartZ - 0.4; real_t lower_z = orbStartZ + 0.4; @@ -322,7 +323,7 @@ void Entity::actPedestalOrb() Entity* parent = uidToEntity(this->parent); if ( !parent ) { - return; + return false; } if ( !parent->pedestalInGround ) @@ -337,7 +338,7 @@ void Entity::actPedestalOrb() flags[PASSABLE] = true; orbTurnVelocity = 0.5; // reset the speed of the orb. removeLightField(); - return; + return true; } else if ( orbInitialised ) { @@ -395,7 +396,7 @@ void Entity::actPedestalOrb() flags[INVISIBLE] = false; flags[UNCLICKABLE] = false; flags[PASSABLE] = false; - return; + return true; } else if ( parent->pedestalHasOrb == parent->pedestalOrbType ) { @@ -410,7 +411,7 @@ void Entity::actPedestalOrb() } else { - return; + return true; } if ( orbHoverDirection == CRYSTAL_HOVER_UP ) //rise state @@ -497,6 +498,7 @@ void Entity::actPedestalOrb() break; } spawnAmbientParticles(40, particleSprite, 10 + rand() % 40, 1.0, false); + return true; } void Entity::pedestalOrbInit() diff --git a/src/actplayer.cpp b/src/actplayer.cpp index 35e3f4b5a..fe5b5bb11 100644 --- a/src/actplayer.cpp +++ b/src/actplayer.cpp @@ -44,7 +44,7 @@ bool settings_smoothmouse = false; #define DEATHCAM_ROTX my->fskill[0] #define DEATHCAM_ROTY my->fskill[1] -void actDeathCam(Entity* my) +bool actDeathCam(Entity* my) { DEATHCAM_TIME++; if ( DEATHCAM_TIME == 1 ) @@ -155,6 +155,7 @@ void actDeathCam(Entity* my) camera.x -= cos(my->yaw) * cos(my->pitch) * 1.5; camera.y -= sin(my->yaw) * cos(my->pitch) * 1.5; camera.z -= sin(my->pitch) * 16; + return true; } #define PLAYER_INIT my->skill[0] @@ -182,11 +183,11 @@ void actDeathCam(Entity* my) #define PLAYER_SHIELDYAW my->fskill[8] #define PLAYERWALKSPEED .12 -void actPlayer(Entity* my) +bool actPlayer(Entity* my) { if (!my) { - return; + return false; } if ( logCheckObstacle ) { @@ -230,10 +231,11 @@ void actPlayer(Entity* my) int weight; bool wearingring = false; bool levitating = false; + bool ret = true; if ( PLAYER_NUM < 0 || PLAYER_NUM >= MAXPLAYERS ) { - return; + return true; } if ( multiplayer == CLIENT ) @@ -864,11 +866,13 @@ void actPlayer(Entity* my) if ( tempItem->node ) { list_RemoveNode(tempItem->node); + ret = false; } else { free(tempItem); tempItem = nullptr; + ret = false; } break; } @@ -1964,6 +1968,7 @@ void actPlayer(Entity* my) continue; // don't drop spells on death, stupid! } list_RemoveNode(node); + ret = false; } stats[0]->helmet = NULL; stats[0]->breastplate = NULL; @@ -2095,7 +2100,7 @@ void actPlayer(Entity* my) } my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } @@ -3568,10 +3573,11 @@ void actPlayer(Entity* my) } } } + return ret; } // client function -void actPlayerLimb(Entity* my) +bool actPlayerLimb(Entity* my) { int i; @@ -3582,7 +3588,7 @@ void actPlayerLimb(Entity* my) if ( stats[PLAYER_NUM]->HP <= 0 ) { my->flags[INVISIBLE] = true; - return; + return true; } } @@ -3615,17 +3621,17 @@ void actPlayerLimb(Entity* my) if (multiplayer != CLIENT) { - return; + return true; } if (my->skill[2] < 0 || my->skill[2] >= MAXPLAYERS ) { - return; + return true; } if (players[my->skill[2]] == nullptr || players[my->skill[2]]->entity == nullptr) { list_RemoveNode(my->mynode); - return; + return false; } //TODO: These three are _NOT_ PLAYERSWAP diff --git a/src/actpowercrystal.cpp b/src/actpowercrystal.cpp index 4cc0b9635..a64b329dc 100644 --- a/src/actpowercrystal.cpp +++ b/src/actpowercrystal.cpp @@ -29,27 +29,27 @@ takes a pointer to the entity that uses it as an argument. -------------------------------------------------------------------------------*/ -void actPowerCrystalBase(Entity* my) +bool actPowerCrystalBase(Entity* my) { if ( my->flags[PASSABLE] ) // stop the compiler optimising into a different entity. { my->flags[PASSABLE] = false; } - return; + return true; } -void actPowerCrystal(Entity* my) +bool actPowerCrystal(Entity* my) { if ( !my ) { - return; + return false; } - my->actPowerCrystal(); + return my->actPowerCrystal(); } -void Entity::actPowerCrystal() +bool Entity::actPowerCrystal() { //Entity* entity; real_t upper_z = this->crystalStartZ - 0.4; @@ -181,7 +181,7 @@ void Entity::actPowerCrystal() if ( multiplayer == CLIENT ) { - return; + return true; } // handle player turning the crystal @@ -209,21 +209,21 @@ void Entity::actPowerCrystal() } } - return; + return true; } // ambient particle effects. -void actPowerCrystalParticleIdle(Entity* my) +bool actPowerCrystalParticleIdle(Entity* my) { if ( !my ) { - return; + return false; } if ( my->skill[0] < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -231,7 +231,7 @@ void actPowerCrystalParticleIdle(Entity* my) my->z += my->vel_z; //my->z -= 0.01; } - return; + return true; } void Entity::powerCrystalCreateElectricityNodes() diff --git a/src/actsink.cpp b/src/actsink.cpp index e7ce4a140..c131557fe 100644 --- a/src/actsink.cpp +++ b/src/actsink.cpp @@ -31,7 +31,7 @@ #define SINK_AMBIENCE my->skill[7] -void actSink(Entity* my) +bool actSink(Entity* my) { SINK_AMBIENCE--; if ( SINK_AMBIENCE <= 0 ) @@ -67,7 +67,7 @@ void actSink(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } //Using the sink. //TODO: Monsters using it? @@ -217,4 +217,5 @@ void actSink(Entity* my) } } } + return true; } diff --git a/src/actspeartrap.cpp b/src/actspeartrap.cpp index c8bb74030..f2ffe57ef 100644 --- a/src/actspeartrap.cpp +++ b/src/actspeartrap.cpp @@ -33,7 +33,7 @@ #define SPEARTRAP_STARTHEIGHT my->fskill[0] #define SPEARTRAP_VELZ my->vel_z -void actSpearTrap(Entity* my) +bool actSpearTrap(Entity* my) { SPEARTRAP_AMBIENCE--; if ( SPEARTRAP_AMBIENCE <= 0 ) @@ -46,7 +46,7 @@ void actSpearTrap(Entity* my) { if (!my->skill[28]) { - return; + return true; } if (my->skill[28] == 2) @@ -159,4 +159,5 @@ void actSpearTrap(Entity* my) } } } + return true; } diff --git a/src/actsprite.cpp b/src/actsprite.cpp index bcc8205e8..bb1ce66fe 100644 --- a/src/actsprite.cpp +++ b/src/actsprite.cpp @@ -31,7 +31,7 @@ #define SPRITE_ANIMSPEED my->skill[2] #define SPRITE_LIT my->skill[5] -void actSprite(Entity* my) +bool actSprite(Entity* my) { if ( !my->skill[6] && SPRITE_LIT ) { @@ -56,13 +56,14 @@ void actSprite(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } + return true; } -void actSpriteNametag(Entity* my) +bool actSpriteNametag(Entity* my) { Entity* parent = uidToEntity(my->parent); if ( parent ) @@ -77,11 +78,13 @@ void actSpriteNametag(Entity* my) { my->flags[INVISIBLE] = true; } + return true; } else { my->flags[INVISIBLE] = true; list_RemoveNode(my->mynode); + return false; } } @@ -200,7 +203,7 @@ Entity* spawnExplosion(Sint16 x, Sint16 y, Sint16 z) return explosion; } -void actSleepZ(Entity* my) +bool actSleepZ(Entity* my) { // spin around my->x -= my->fskill[0]; @@ -215,13 +218,14 @@ void actSleepZ(Entity* my) if ( my->z < -128 ) { list_RemoveNode(my->mynode); - return; + return false; } // scale up my->scalex = fmin(my->scalex + 0.01, 0.75); my->scaley = fmin(my->scaley + 0.01, 0.75); my->scalez = fmin(my->scalez + 0.01, 0.75); + return true; } Entity* spawnSleepZ(Sint16 x, Sint16 y, Sint16 z) diff --git a/src/actsummontrap.cpp b/src/actsummontrap.cpp index 51d80f5f4..4417fcdbb 100644 --- a/src/actsummontrap.cpp +++ b/src/actsummontrap.cpp @@ -31,11 +31,11 @@ See LICENSE for details. #define SUMMONTRAP_FIRED my->skill[6] #define SUMMONTRAP_INITIALIZED my->skill[7] -void actSummonTrap(Entity* my) +bool actSummonTrap(Entity* my) { if ( my->skill[28] == 0 || (SUMMONTRAP_INITIALIZED && SUMMONTRAP_FIRED) ) { - return; + return true; } // received on signal @@ -95,7 +95,7 @@ void actSummonTrap(Entity* my) // trap breaks! SUMMONTRAP_FIRED = 1; playSoundEntity(my, 76, 128); - return; + return true; } if ( SUMMONTRAP_SPAWNCYCLES > 0 ) @@ -116,5 +116,5 @@ void actSummonTrap(Entity* my) } } - return; + return true; } diff --git a/src/actteleporter.cpp b/src/actteleporter.cpp index 12c788e2a..dcab43fc8 100644 --- a/src/actteleporter.cpp +++ b/src/actteleporter.cpp @@ -28,17 +28,17 @@ -------------------------------------------------------------------------------*/ -void actTeleporter(Entity* my) +bool actTeleporter(Entity* my) { if ( !my ) { - return; + return false; } - my->actTeleporter(); + return my->actTeleporter(); } -void Entity::actTeleporter() +bool Entity::actTeleporter() { int i; @@ -73,7 +73,7 @@ void Entity::actTeleporter() break; } players[i]->entity->teleporterMove(teleporterX, teleporterY, teleporterType); - return; + return true; } } } @@ -88,4 +88,5 @@ void Entity::actTeleporter() yaw += 0.01; // rotate slowly on my axis sprite = 620;// +(this->ticks / 20) % 4; // animate } -} \ No newline at end of file + return true; +} diff --git a/src/actthrown.cpp b/src/actthrown.cpp index dad1c8ef8..59e405c45 100644 --- a/src/actthrown.cpp +++ b/src/actthrown.cpp @@ -42,7 +42,7 @@ #define THROWN_LIFE my->skill[16] #define THROWN_BOUNCES my->skill[17] -void actThrown(Entity* my) +bool actThrown(Entity* my) { Item* item = nullptr; Category cat = GEM; @@ -117,7 +117,7 @@ void actThrown(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } Entity* parent = uidToEntity(my->parent); @@ -180,13 +180,13 @@ void actThrown(Entity* my) playSoundEntity(my, 162, 64); free(item); list_RemoveNode(my->mynode); - return; + return false; } else if ( specialMonster ) { free(item); list_RemoveNode(my->mynode); - return; + return false; } else { @@ -219,7 +219,7 @@ void actThrown(Entity* my) } free(item); list_RemoveNode(my->mynode); - return; + return false; } } else @@ -295,7 +295,7 @@ void actThrown(Entity* my) free(item); } list_RemoveNode(my->mynode); - return; + return false; } } } @@ -307,7 +307,7 @@ void actThrown(Entity* my) if ( my->z > 128 ) { list_RemoveNode(my->mynode); - return; + return false; } // horizontal motion @@ -359,7 +359,7 @@ void actThrown(Entity* my) if ( parent && parent->checkFriend(hit.entity) ) { list_RemoveNode(my->mynode); - return; + return false; } } if ( hit.entity->behavior == &actMonster || hit.entity->behavior == &actPlayer ) @@ -679,7 +679,7 @@ void actThrown(Entity* my) free(item); } list_RemoveNode(my->mynode); - return; + return false; } else if ( itemCategory(item) == THROWN && (item->type == STEEL_CHAKRAM || item->type == CRYSTAL_SHURIKEN) && hit.entity == NULL ) { @@ -717,7 +717,7 @@ void actThrown(Entity* my) } free(item); list_RemoveNode(my->mynode); - return; + return false; } if ( item ) @@ -738,4 +738,5 @@ void actThrown(Entity* my) THROWN_VELY = THROWN_VELY * .99; my->pitch += result * .01; } + return true; } diff --git a/src/acttorch.cpp b/src/acttorch.cpp index 4d984d68c..57b8486a9 100644 --- a/src/acttorch.cpp +++ b/src/acttorch.cpp @@ -33,7 +33,7 @@ bool flickerLights = true; -void actTorch(Entity* my) +bool actTorch(Entity* my) { int i; @@ -60,7 +60,7 @@ void actTorch(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } // lighting @@ -106,7 +106,7 @@ void actTorch(Entity* my) Item* item = newItem(TOOL_TORCH, WORN, 0, 1, 0, true, NULL); itemPickup(i, item); free(item); - return; + return false; } } } @@ -124,13 +124,14 @@ void actTorch(Entity* my) my->clearMonsterInteract(); } } + return true; } #define TORCH_LIGHTING my->skill[0] #define TORCH_FLICKER my->skill[1] #define TORCH_FIRE my->skill[3] -void actCrystalShard(Entity* my) +bool actCrystalShard(Entity* my) { int i; @@ -157,7 +158,7 @@ void actCrystalShard(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } // lighting @@ -204,28 +205,29 @@ void actCrystalShard(Entity* my) Item* item = newItem(TOOL_CRYSTALSHARD, WORN, 0, 1, 0, true, NULL); itemPickup(i, item); free(item); - return; + return false; } } } } + return true; } -void actLightSource(Entity* my) +bool actLightSource(Entity* my) { if ( !my ) { - return; + return false; } - my->actLightSource(); + return my->actLightSource(); } #define LIGHTSOURCE_LIGHT skill[8] #define LIGHTSOURCE_FLICKER skill[9] #define LIGHTSOURCE_ENABLED skill[10] -void Entity::actLightSource() +bool Entity::actLightSource() { if ( multiplayer != CLIENT ) { @@ -285,7 +287,7 @@ void Entity::actLightSource() --lightSourceDelayCounter; if ( lightSourceDelayCounter != 0 ) { - return; + return true; } } else if ( lightSourceInvertPower == 0 && lightSourceDelay > 0 ) @@ -307,7 +309,7 @@ void Entity::actLightSource() removeLightField(); if ( multiplayer == CLIENT ) { - return; + return true; } if ( lightSourceAlwaysOn == 1 || (circuit_status == CIRCUIT_ON && !lightSourceInvertPower) @@ -320,7 +322,7 @@ void Entity::actLightSource() --lightSourceDelayCounter; if ( lightSourceDelayCounter != 0 ) { - return; + return true; } } else if ( lightSourceInvertPower == 1 && lightSourceDelay > 0 ) @@ -336,4 +338,5 @@ void Entity::actLightSource() } } } + return true; } diff --git a/src/actwallbuster.cpp b/src/actwallbuster.cpp index df6c0b5da..783b3007d 100644 --- a/src/actwallbuster.cpp +++ b/src/actwallbuster.cpp @@ -26,13 +26,13 @@ -------------------------------------------------------------------------------*/ -void actWallBuster(Entity* my) +bool actWallBuster(Entity* my) { int c; if ( !my->skill[28] ) { - return; + return false; } // received on signal @@ -61,16 +61,18 @@ void actWallBuster(Entity* my) } } list_RemoveNode(my->mynode); + return false; } + return true; } -void actWallBuilder(Entity* my) +bool actWallBuilder(Entity* my) { int c; if ( !my->skill[28] ) { - return; + return false; } // received on signal @@ -98,5 +100,7 @@ void actWallBuilder(Entity* my) } } list_RemoveNode(my->mynode); + return false; } -} \ No newline at end of file + return true; +} diff --git a/src/entity.cpp b/src/entity.cpp index 403fea555..39af5da12 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -9184,17 +9184,17 @@ spell_t* Entity::getActiveMagicEffect(int spellID) return spell; } -void actAmbientParticleEffectIdle(Entity* my) +bool actAmbientParticleEffectIdle(Entity* my) { if ( !my ) { - return; + return false; } if ( my->particleDuration < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -9214,7 +9214,7 @@ void actAmbientParticleEffectIdle(Entity* my) } } - return; + return true; } void Entity::spawnAmbientParticles(int chance, int particleSprite, int duration, double particleScale, bool shrink) @@ -11898,4 +11898,4 @@ std::vector TileEntityListHandler::getEntitiesWithinRadiusAroundEntity( int u = static_cast(entity->x) >> 4; int v = static_cast(entity->y) >> 4; return getEntitiesWithinRadius(u, v, radius); -} \ No newline at end of file +} diff --git a/src/entity.hpp b/src/entity.hpp index d11726b84..e7cb77aac 100644 --- a/src/entity.hpp +++ b/src/entity.hpp @@ -413,7 +413,7 @@ class Entity void giveClientStats(); // behavior function pointer - void (*behavior)(class Entity* my); + bool (*behavior)(class Entity* my); bool ranbehavior; void setObituary(char* obituary); @@ -536,27 +536,27 @@ class Entity bool checkFriend(Entity* your); //Act functions. - void actChest(); - void actPowerCrystal(); - void actGate(); - void actPedestalBase(); - void actPedestalOrb(); - void actMidGamePortal(); - void actExpansionEndGamePortal(); - void actTeleporter(); - void actMagicTrapCeiling(); + bool actChest(); + bool actPowerCrystal(); + bool actGate(); + bool actPedestalBase(); + bool actPedestalOrb(); + bool actMidGamePortal(); + bool actExpansionEndGamePortal(); + bool actTeleporter(); + bool actMagicTrapCeiling(); bool magicFallingCollision(); bool magicOrbitingCollision(); - void actFurniture(); - void actPistonCam(); - void actStalagCeiling(); - void actStalagFloor(); - void actStalagColumn(); - void actColumn(); - void actSoundSource(); - void actLightSource(); - void actTextSource(); - void actSignalTimer(); + bool actFurniture(); + bool actPistonCam(); + bool actStalagCeiling(); + bool actStalagFloor(); + bool actStalagColumn(); + bool actColumn(); + bool actSoundSource(); + bool actLightSource(); + bool actTextSource(); + bool actSignalTimer(); Monster getRace() const { @@ -592,7 +592,7 @@ class Entity //--monster helmet limb offsets void setHelmetLimbOffset(Entity* helm); - void actMonsterLimb(bool processLight = false); + bool actMonsterLimb(bool processLight = false); void removeMonsterDeathNodes(); @@ -810,8 +810,8 @@ list_t* checkTileForEntity(int x, int y); //Don't forget to free the list return void getItemsOnTile(int x, int y, list_t** list); //--- Entity act* functions --- -void actMonster(Entity* my); -void actPlayer(Entity* my); +bool actMonster(Entity* my); +bool actPlayer(Entity* my); /* * NOTE: Potion effects @@ -832,18 +832,18 @@ void actPlayer(Entity* my); * value 14 = POTION_PARALYSIS */ //TODO: Allow for cursed fountains. Any fountain that has a negative effect has, say, skill[4] set to 1 to indicate cursed. Used for monster behavior and for effects of things like healing potions. -void actFountain(Entity* my); -void actSink(Entity* my); +bool actFountain(Entity* my); +bool actSink(Entity* my); //--- Mechanism functions --- -void actCircuit(Entity* my); -void actSwitch(Entity* my); //Needs to be called periodically to ensure network's powered state is correct. +bool actCircuit(Entity* my); +bool actSwitch(Entity* my); //Needs to be called periodically to ensure network's powered state is correct. void getPowerablesOnTile(int x, int y, list_t** list); //Stores a list of all circuits and mechanisms, on the tile (in map coordinates), in list. -void actGate(Entity* my); -void actArrowTrap(Entity* my); -void actTrap(Entity* my); -void actTrapPermanent(Entity* my); -void actSwitchWithTimer(Entity* my); +bool actGate(Entity* my); +bool actArrowTrap(Entity* my); +bool actTrap(Entity* my); +bool actTrapPermanent(Entity* my); +bool actSwitchWithTimer(Entity* my); /* * Note: Circuits and mechanisms use skill[28] to signify powered state. @@ -854,35 +854,35 @@ void actSwitchWithTimer(Entity* my); */ //---Chest/container functions--- -void actChest(Entity* my); -void actChestLid(Entity* my); +bool actChest(Entity* my); +bool actChestLid(Entity* my); void closeChestClientside(); //Called by the client to manage all clientside stuff relating to closing a chest. -void addItemToChestClientside(Item* item); //Called by the client to manage all clientside stuff relating to adding an item to a chest. +bool addItemToChestClientside(Item* item); //Called by the client to manage all clientside stuff relating to adding an item to a chest. //---Stalag functions--- -void actStalagFloor(Entity* my); -void actStalagCeiling(Entity* my); -void actStalagColumn(Entity* my); +bool actStalagFloor(Entity* my); +bool actStalagCeiling(Entity* my); +bool actStalagColumn(Entity* my); //---Ceiling Tile functions--- -void actCeilingTile(Entity* my); +bool actCeilingTile(Entity* my); //--Piston functions-- -void actPistonBase(Entity* my); -void actPistonCam(Entity* my); +bool actPistonBase(Entity* my); +bool actPistonCam(Entity* my); -void actColumn(Entity* my); +bool actColumn(Entity* my); //--Floor vegetation-- -void actFloorDecoration(Entity* my); +bool actFloorDecoration(Entity* my); //---Magic entity functions--- -void actMagiclightBall(Entity* my); +bool actMagiclightBall(Entity* my); //---Misc act functions--- -void actAmbientParticleEffectIdle(Entity* my); +bool actAmbientParticleEffectIdle(Entity* my); -void actTextSource(Entity* my); +bool actTextSource(Entity* my); //checks if a sprite falls in certain sprite ranges @@ -944,4 +944,4 @@ extern bool flickerLights; void boulderSokobanOnDestroy(bool pushedOffLedge); int playerEntityMatchesUid(Uint32 uid); // Returns >= 0 if player uid matches uid. -bool monsterNameIsGeneric(Stat& monsterStats); // returns true if a monster's name is a generic decription rather than a miniboss. \ No newline at end of file +bool monsterNameIsGeneric(Stat& monsterStats); // returns true if a monster's name is a generic decription rather than a miniboss. diff --git a/src/entity_editor.cpp b/src/entity_editor.cpp index c2071a2e8..b26db187d 100644 --- a/src/entity_editor.cpp +++ b/src/entity_editor.cpp @@ -343,23 +343,23 @@ bool Entity::isInvisible() const return false; } -void actMonster(Entity* my) +bool actMonster(Entity* my) { - return; + return true; } -void actPlayer(Entity* my) +bool actPlayer(Entity* my) { - return; + return true; } -void actSpriteNametag(Entity* my) +bool actSpriteNametag(Entity* my) { // dummy function - return; + return true; } int playerEntityMatchesUid(Uint32 uid) { return -1; -} \ No newline at end of file +} diff --git a/src/game.cpp b/src/game.cpp index 4a414bcab..b3c3257f0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -611,13 +611,13 @@ void gameLogic(void) TileEntityList.addEntity(*entity); } - (*entity->behavior)(entity); - - if ( ox != static_cast(entity->x) >> 4 - || oy != static_cast(entity->y) >> 4 ) - { - // if entity moved into a new tile, update it's tile position in global tile list. - TileEntityList.updateEntity(*entity); + if ((*entity->behavior)(entity)) { + if ( ox != static_cast(entity->x) >> 4 + || oy != static_cast(entity->y) >> 4 ) + { + // if entity moved into a new tile, update it's tile position in global tile list. + TileEntityList.updateEntity(*entity); + } } } if ( entitiesdeleted.first != nullptr ) diff --git a/src/game.hpp b/src/game.hpp index d868f3d81..3ea718c93 100644 --- a/src/game.hpp +++ b/src/game.hpp @@ -159,67 +159,67 @@ void handleButtons(void); void gameLogic(void); // behavior function prototypes: -void actAnimator(Entity* my); -void actRotate(Entity* my); -void actLiquid(Entity* my); -void actEmpty(Entity* my); -void actFurniture(Entity* my); -void actMCaxe(Entity* my); -void actDoorFrame(Entity* my); -void actDeathCam(Entity* my); -void actPlayerLimb(Entity* my); -void actTorch(Entity* my); -void actCrystalShard(Entity* my); -void actDoor(Entity* my); -void actHudWeapon(Entity* my); -void actHudShield(Entity* my); -void actItem(Entity* my); -void actGoldBag(Entity* my); -void actGib(Entity* my); +bool actAnimator(Entity* my); +bool actRotate(Entity* my); +bool actLiquid(Entity* my); +bool actEmpty(Entity* my); +bool actFurniture(Entity* my); +bool actMCaxe(Entity* my); +bool actDoorFrame(Entity* my); +bool actDeathCam(Entity* my); +bool actPlayerLimb(Entity* my); +bool actTorch(Entity* my); +bool actCrystalShard(Entity* my); +bool actDoor(Entity* my); +bool actHudWeapon(Entity* my); +bool actHudShield(Entity* my); +bool actItem(Entity* my); +bool actGoldBag(Entity* my); +bool actGib(Entity* my); Entity* spawnGib(Entity* parentent); Entity* spawnGibClient(Sint16 x, Sint16 y, Sint16 z, Sint16 sprite); void serverSpawnGibForClient(Entity* gib); -void actLadder(Entity* my); -void actLadderUp(Entity* my); -void actPortal(Entity* my); -void actWinningPortal(Entity* my); -void actFlame(Entity* my); -void actCampfire(Entity* my); +bool actLadder(Entity* my); +bool actLadderUp(Entity* my); +bool actPortal(Entity* my); +bool actWinningPortal(Entity* my); +bool actFlame(Entity* my); +bool actCampfire(Entity* my); Entity* spawnFlame(Entity* parentent, Sint32 sprite); -void actMagic(Entity* my); +bool actMagic(Entity* my); Entity* castMagic(Entity* parentent); -void actSprite(Entity* my); -void actSpriteNametag(Entity* my); -void actSleepZ(Entity* my); +bool actSprite(Entity* my); +bool actSpriteNametag(Entity* my); +bool actSleepZ(Entity* my); Entity* spawnBang(Sint16 x, Sint16 y, Sint16 z); Entity* spawnExplosion(Sint16 x, Sint16 y, Sint16 z); Entity* spawnSleepZ(Sint16 x, Sint16 y, Sint16 z); -void actArrow(Entity* my); -void actBoulder(Entity* my); -void actBoulderTrap(Entity* my); -void actBoulderTrapEast(Entity* my); -void actBoulderTrapWest(Entity* my); -void actBoulderTrapSouth(Entity* my); -void actBoulderTrapNorth(Entity* my); -void actHeadstone(Entity* my); -void actThrown(Entity* my); -void actBeartrap(Entity* my); -void actBeartrapLaunched(Entity* my); -void actSpearTrap(Entity* my); -void actWallBuster(Entity* my); -void actWallBuilder(Entity* my); -void actPowerCrystalBase(Entity* my); -void actPowerCrystal(Entity* my); -void actPowerCrystalParticleIdle(Entity* my); -void actPedestalBase(Entity* my); -void actPedestalOrb(Entity* my); -void actMidGamePortal(Entity* my); -void actTeleporter(Entity* my); -void actMagicTrapCeiling(Entity* my); -void actExpansionEndGamePortal(Entity* my); -void actSoundSource(Entity* my); -void actLightSource(Entity* my); -void actSignalTimer(Entity* my); +bool actArrow(Entity* my); +bool actBoulder(Entity* my); +bool actBoulderTrap(Entity* my); +bool actBoulderTrapEast(Entity* my); +bool actBoulderTrapWest(Entity* my); +bool actBoulderTrapSouth(Entity* my); +bool actBoulderTrapNorth(Entity* my); +bool actHeadstone(Entity* my); +bool actThrown(Entity* my); +bool actBeartrap(Entity* my); +bool actBeartrapLaunched(Entity* my); +bool actSpearTrap(Entity* my); +bool actWallBuster(Entity* my); +bool actWallBuilder(Entity* my); +bool actPowerCrystalBase(Entity* my); +bool actPowerCrystal(Entity* my); +bool actPowerCrystalParticleIdle(Entity* my); +bool actPedestalBase(Entity* my); +bool actPedestalOrb(Entity* my); +bool actMidGamePortal(Entity* my); +bool actTeleporter(Entity* my); +bool actMagicTrapCeiling(Entity* my); +bool actExpansionEndGamePortal(Entity* my); +bool actSoundSource(Entity* my); +bool actLightSource(Entity* my); +bool actSignalTimer(Entity* my); void startMessages(); diff --git a/src/magic/act_HandMagic.cpp b/src/magic/act_HandMagic.cpp index a46ea1976..bbdfa5217 100644 --- a/src/magic/act_HandMagic.cpp +++ b/src/magic/act_HandMagic.cpp @@ -135,13 +135,13 @@ void spellcastingAnimationManager_completeSpell(spellcasting_animation_manager_t [12:49:46 PM] Sheridan Kane Rathbun: the first step is to get the hands visible on the screen when you cast. worry about moving them when that critical part is done. */ -void actLeftHandMagic(Entity* my) +bool actLeftHandMagic(Entity* my) { //int c = 0; if (intro == true) { my->flags[INVISIBLE] = true; - return; + return true; } //Initialize @@ -157,7 +157,7 @@ void actLeftHandMagic(Entity* my) magicLeftHand = nullptr; spellcastingAnimationManager_deactivate(&cast_animation); list_RemoveNode(my->mynode); - return; + return false; } //Set the initial values. (For the particle spray) @@ -320,7 +320,7 @@ void actLeftHandMagic(Entity* my) //Final position code. if (players[clientnum] == nullptr || players[clientnum]->entity == nullptr) { - return; + return true; } //double defaultpitch = PI / 8.f; //double defaultpitch = 0; @@ -337,14 +337,15 @@ void actLeftHandMagic(Entity* my) my->yaw = HANDMAGIC_YAW - camera_shakex2; my->pitch = defaultpitch + HANDMAGIC_PITCH - camera_shakey2 / 200.f; my->roll = HANDMAGIC_ROLL; + return true; } -void actRightHandMagic(Entity* my) +bool actRightHandMagic(Entity* my) { if (intro == true) { my->flags[INVISIBLE] = true; - return; + return true; } //Initialize @@ -358,7 +359,7 @@ void actRightHandMagic(Entity* my) { magicRightHand = nullptr; list_RemoveNode(my->mynode); - return; + return false; } my->x = 8; @@ -493,7 +494,7 @@ void actRightHandMagic(Entity* my) //Final position code. if (players[clientnum] == nullptr || players[clientnum]->entity == nullptr) { - return; + return true; } //double defaultpitch = PI / 8.f; //double defaultpitch = 0; @@ -511,4 +512,5 @@ void actRightHandMagic(Entity* my) my->yaw = HANDMAGIC_YAW - camera_shakex2; my->pitch = defaultpitch + HANDMAGIC_PITCH - camera_shakey2 / 200.f; my->roll = HANDMAGIC_ROLL; + return true; } diff --git a/src/magic/actmagic.cpp b/src/magic/actmagic.cpp index 5f33e8261..d19b5df58 100644 --- a/src/magic/actmagic.cpp +++ b/src/magic/actmagic.cpp @@ -23,12 +23,12 @@ #include "../player.hpp" #include "magic.hpp" -void actMagiclightBall(Entity* my) +bool actMagiclightBall(Entity* my) { Entity* caster = NULL; if (!my) { - return; + return false; } my->skill[2] = -10; // so the client sets the behavior of this entity @@ -65,7 +65,7 @@ void actMagiclightBall(Entity* my) } lightball_timer--; - return; + return true; } my->yaw += .01; @@ -93,7 +93,7 @@ void actMagiclightBall(Entity* my) if (!my->children.first) { list_RemoveNode(my->mynode); //Delete the light spell.C - return; + return false; } node_t* node = NULL; @@ -103,7 +103,7 @@ void actMagiclightBall(Entity* my) if (!spell) { list_RemoveNode(my->mynode); - return; //We need the source spell! + return false; //We need the source spell! } caster = uidToEntity(spell->caster); @@ -116,7 +116,7 @@ void actMagiclightBall(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); //Delete the light spell. - return; + return false; } } } @@ -124,7 +124,7 @@ void actMagiclightBall(Entity* my) { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } // if the spell has been unsustained, remove it @@ -151,7 +151,7 @@ void actMagiclightBall(Entity* my) } my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } if (magic_init) @@ -194,7 +194,7 @@ void actMagiclightBall(Entity* my) } my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } @@ -223,7 +223,7 @@ void actMagiclightBall(Entity* my) Entity* parent = uidToEntity(my->parent); if ( !parent ) { - return; + return true; } double distance = sqrt(pow(my->x - parent->x, 2) + pow(my->y - parent->y, 2)); if ( distance > MAGICLIGHT_BALL_FOLLOW_DISTANCE || my->path) @@ -430,18 +430,19 @@ void actMagiclightBall(Entity* my) lightball_movement_timer = 0; //Start off at 0 so that it moves towards the player as soon as it's created (since it's created farther away from the player). } } + return true; } -void actMagicMissile(Entity* my) //TODO: Verify this function. +bool actMagicMissile(Entity* my) //TODO: Verify this function. { if (!my || !my->children.first || !my->children.first->element) { - return; + return false; } spell_t* spell = (spell_t*)my->children.first->element; if (!spell) { - return; + return false; } //node_t *node = NULL; spellElement_t* element = NULL; @@ -465,7 +466,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. if (MAGIC_LIFE >= MAGIC_MAXLIFE) { list_RemoveNode(my->mynode); - return; + return false; } node = spell->elements.first; @@ -844,7 +845,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. } } } - return; + return true; } // Test for Friendly Fire, if Friendly Fire is OFF, delete the missile @@ -854,7 +855,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. { my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } @@ -1034,7 +1035,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->doorHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if ( hit.entity->behavior == &actChest ) { @@ -1043,7 +1044,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->chestHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if (hit.entity->behavior == &actFurniture ) { @@ -1144,7 +1145,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->doorHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if ( hit.entity->behavior == &actChest ) { @@ -1153,7 +1154,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->chestHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if (hit.entity->behavior == &actFurniture ) { @@ -1197,7 +1198,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. playSoundEntity(hit.entity, 28, 128); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } @@ -1272,7 +1273,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if (hit.entity->behavior == &actChest) { @@ -1281,7 +1282,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->chestHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if (hit.entity->behavior == &actFurniture ) { @@ -1325,7 +1326,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. playSoundEntity(hit.entity, 28, 128); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } } } @@ -1590,7 +1591,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if ( hit.entity->behavior == &actChest ) { @@ -1599,7 +1600,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. hit.entity->chestHandleDamageMagic(damage, *my, parent); my->removeLightField(); list_RemoveNode(my->mynode); - return; + return false; } else if (hit.entity->behavior == &actFurniture ) { @@ -2223,8 +2224,9 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. if ( my->mynode ) { list_RemoveNode(my->mynode); + return false; } - return; + return true; } } @@ -2286,9 +2288,10 @@ void actMagicMissile(Entity* my) //TODO: Verify this function. MAGIC_MAXLIFE = 512; } } + return true; } -void actMagicClient(Entity* my) +bool actMagicClient(Entity* my) { my->removeLightField(); my->light = lightSphereShadow(my->x / 16, my->y / 16, 8, 192); @@ -2319,14 +2322,16 @@ void actMagicClient(Entity* my) // spawn particles spawnMagicParticle(my); + return true; } -void actMagicClientNoLight(Entity* my) +bool actMagicClientNoLight(Entity* my) { spawnMagicParticle(my); // simply spawn particles + return true; } -void actMagicParticle(Entity* my) +bool actMagicParticle(Entity* my) { my->x += my->vel_x; my->y += my->vel_y; @@ -2340,8 +2345,9 @@ void actMagicParticle(Entity* my) my->scaley = 0; my->scalez = 0; list_RemoveNode(my->mynode); - return; + return false; } + return true; } Entity* spawnMagicParticle(Entity* parentent) @@ -2564,12 +2570,12 @@ void createParticleCircling(Entity* parent, int duration, int sprite) #define PARTICLE_LIFE my->skill[0] #define PARTICLE_CASTER my->skill[1] -void actParticleCircle(Entity* my) +bool actParticleCircle(Entity* my) { if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -2594,6 +2600,7 @@ void actParticleCircle(Entity* my) my->scalex *= 0.995; my->scaley *= 0.995; my->scalez *= 0.995; + return true; } } @@ -2654,11 +2661,12 @@ void createParticleRock(Entity* parent) } } -void actParticleRock(Entity* my) +bool actParticleRock(Entity* my) { if ( PARTICLE_LIFE < 0 || my->z > 10 ) { list_RemoveNode(my->mynode); + return false; } else { @@ -2684,31 +2692,32 @@ void actParticleRock(Entity* my) my->z += my->vel_z; my->vel_z *= 1.1; } + return true; } - return; } -void actParticleDot(Entity* my) +bool actParticleDot(Entity* my) { if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); + return false; } else { --PARTICLE_LIFE; my->z += my->vel_z; //my->z -= 0.01; + return true; } - return; } -void actParticleTest(Entity* my) +bool actParticleTest(Entity* my) { if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -2717,6 +2726,7 @@ void actParticleTest(Entity* my) my->y += my->vel_y; my->z += my->vel_z; //my->z -= 0.01; + return true; } } @@ -2947,12 +2957,12 @@ Entity* createParticleTimer(Entity* parent, int duration, int sprite) return entity; } -void actParticleErupt(Entity* my) +bool actParticleErupt(Entity* my) { if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -2983,10 +2993,11 @@ void actParticleErupt(Entity* my) my->vel_z *= (1 / 0.8); my->vel_z = std::max(my->vel_z, -0.8); } + return true; } } -void actParticleTimer(Entity* my) +bool actParticleTimer(Entity* my) { if( PARTICLE_LIFE < 0 ) { @@ -3203,7 +3214,7 @@ void actParticleTimer(Entity* my) } } list_RemoveNode(my->mynode); - return; + return false; } else { @@ -3266,9 +3277,10 @@ void actParticleTimer(Entity* my) --my->particleTimerPreDelay; } } + return true; } -void actParticleSap(Entity* my) +bool actParticleSap(Entity* my) { real_t decel = 0.9; real_t accel = 0.9; @@ -3277,7 +3289,7 @@ void actParticleSap(Entity* my) if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -3291,7 +3303,7 @@ void actParticleSap(Entity* my) else { list_RemoveNode(my->mynode); - return; + return false; } if ( my->skill[1] == 0 ) @@ -3346,9 +3358,10 @@ void actParticleSap(Entity* my) my->scalez *= 0.99; --PARTICLE_LIFE; } + return true; } -void actParticleSapCenter(Entity* my) +bool actParticleSapCenter(Entity* my) { // init if ( my->skill[3] == 0 ) @@ -3360,7 +3373,7 @@ void actParticleSapCenter(Entity* my) if ( multiplayer == CLIENT ) { - return; + return true; } Entity* parent = uidToEntity(my->parent); @@ -3421,7 +3434,7 @@ void actParticleSapCenter(Entity* my) spawnMagicEffectParticles(parent->x, parent->y, parent->z, my->skill[5]); } list_RemoveNode(my->mynode); - return; + return false; } // calculate direction to caster and move. @@ -3460,17 +3473,18 @@ void actParticleSapCenter(Entity* my) // no parent, no target to travel to. list_RemoveNode(my->mynode); - return; + return false; } if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { --PARTICLE_LIFE; + return true; } } @@ -3550,11 +3564,12 @@ void createParticleExplosionCharge(Entity* parent, int sprite, int particleCount } } -void actParticleExplosionCharge(Entity* my) +bool actParticleExplosionCharge(Entity* my) { if ( PARTICLE_LIFE < 0 || (my->z < -4 && rand() % 4 == 0) || (ticks % 14 == 0 && uidToEntity(my->parent) == nullptr) ) { list_RemoveNode(my->mynode); + return false; } else { @@ -3567,8 +3582,8 @@ void actParticleExplosionCharge(Entity* my) my->scaley /= 0.99; my->scalez /= 0.99; //my->z -= 0.01; + return true; } - return; } bool Entity::magicFallingCollision() @@ -3752,12 +3767,12 @@ void createParticleFollowerCommand(real_t x, real_t y, real_t z, int sprite) } -void actParticleFollowerCommand(Entity* my) +bool actParticleFollowerCommand(Entity* my) { if ( PARTICLE_LIFE < 0 ) { list_RemoveNode(my->mynode); - return; + return false; } else { @@ -3768,6 +3783,7 @@ void actParticleFollowerCommand(Entity* my) { my->vel_z *= 0.9; } + return true; } } @@ -3801,7 +3817,7 @@ void createParticleCharmMonster(Entity* parent) entity->setUID(-3); } -void actParticleCharmMonster(Entity* my) +bool actParticleCharmMonster(Entity* my) { if ( PARTICLE_LIFE < 0 ) { @@ -3834,7 +3850,7 @@ void actParticleCharmMonster(Entity* my) yaw += 2 * PI / numParticles; } list_RemoveNode(my->mynode); - return; + return false; } else { @@ -3861,5 +3877,6 @@ void actParticleCharmMonster(Entity* my) { my->vel_z *= 0.9; } + return true; } } diff --git a/src/magic/magic.hpp b/src/magic/magic.hpp index 6304124e6..9f2740fbc 100644 --- a/src/magic/magic.hpp +++ b/src/magic/magic.hpp @@ -428,27 +428,27 @@ void equipSpell(spell_t* spell, int playernum); Entity* castSpell(Uint32 caster_uid, spell_t* spell, bool using_magicstaff, bool trap); void castSpellInit(Uint32 caster_uid, spell_t* spell); //Initiates the spell animation, then hands off the torch to it, which, when finished, calls castSpell. -void actMagicTrap(Entity* my); -void actMagicStatusEffect(Entity* my); -void actMagicMissile(Entity* my); -void actMagicClient(Entity* my); -void actMagicClientNoLight(Entity* my); -void actMagicParticle(Entity* my); +bool actMagicTrap(Entity* my); +bool actMagicStatusEffect(Entity* my); +bool actMagicMissile(Entity* my); +bool actMagicClient(Entity* my); +bool actMagicClientNoLight(Entity* my); +bool actMagicParticle(Entity* my); Entity* spawnMagicParticle(Entity* parentent); void spawnMagicEffectParticles(Sint16 x, Sint16 y, Sint16 z, Uint32 sprite); void createParticle1(Entity* caster, int player); void createParticleCircling(Entity* parent, int duration, int sprite); -void actParticleCircle(Entity* my); -void actParticleDot(Entity* my); -void actParticleRock(Entity* my); -void actParticleTest(Entity* my); -void actParticleErupt(Entity* my); -void actParticleTimer(Entity* my); -void actParticleSap(Entity* my); -void actParticleSapCenter(Entity* my); -void actParticleExplosionCharge(Entity* my); -void actParticleFollowerCommand(Entity* my); -void actParticleCharmMonster(Entity* my); +bool actParticleCircle(Entity* my); +bool actParticleDot(Entity* my); +bool actParticleRock(Entity* my); +bool actParticleTest(Entity* my); +bool actParticleErupt(Entity* my); +bool actParticleTimer(Entity* my); +bool actParticleSap(Entity* my); +bool actParticleSapCenter(Entity* my); +bool actParticleExplosionCharge(Entity* my); +bool actParticleFollowerCommand(Entity* my); +bool actParticleCharmMonster(Entity* my); void createParticleDropRising(Entity* parent, int sprite, double scale); void createParticleDot(Entity* parent); @@ -487,8 +487,8 @@ void spell_changeHealth(Entity* entity, int amount); //This function changes an //-----Spell Casting Animation----- //The two hand animation functions. -void actLeftHandMagic(Entity* my); -void actRightHandMagic(Entity* my); +bool actLeftHandMagic(Entity* my); +bool actRightHandMagic(Entity* my); typedef struct spellcastingAnimationManager { diff --git a/src/mechanisms.cpp b/src/mechanisms.cpp index e5e07f896..1045f5102 100644 --- a/src/mechanisms.cpp +++ b/src/mechanisms.cpp @@ -19,9 +19,10 @@ //Circuits do not overlap. They connect to all their neighbors, allowing for circuits to interfere with eachother. -void actCircuit(Entity* my) +bool actCircuit(Entity* my) { my->flags[PASSABLE] = true; // these should ALWAYS be passable. No exceptions + return true; } void Entity::circuitPowerOn() @@ -161,7 +162,7 @@ void Entity::mechanismPowerOff() */ -void actSwitch(Entity* my) +bool actSwitch(Entity* my) { //TODO: If powered on, and it detects a depowered neighbor, it should pulse that neighbor to turn on. //Thus, this function needs to be called periodically. @@ -225,9 +226,10 @@ void actSwitch(Entity* my) my->roll = PI / 4; } } + return true; } -void actSwitchWithTimer(Entity* my) +bool actSwitchWithTimer(Entity* my) { my->flags[PASSABLE] = true; // these should ALWAYS be passable. No exceptions @@ -356,10 +358,11 @@ void actSwitchWithTimer(Entity* my) } } } + return true; } #define TRAP_ON my->skill[0] -void actTrap(Entity* my) +bool actTrap(Entity* my) { // activates circuit when certain entities are occupying its tile node_t* node; @@ -402,10 +405,11 @@ void actTrap(Entity* my) TRAP_ON = 0; } } + return true; } #define TRAPPERMANENT_ON my->skill[0] -void actTrapPermanent(Entity* my) +bool actTrapPermanent(Entity* my) { // activates circuit when certain entities are occupying its tile // unlike actTrap, never deactivates @@ -422,7 +426,7 @@ void actTrapPermanent(Entity* my) { if ( entity->x < 26 * 16 || entity->y < 6 * 16 || entity->y >= 26 * 16 ) // hardcoded, I know... { - return; + return true; } } } @@ -461,7 +465,7 @@ void actTrapPermanent(Entity* my) { if ( entity->x < 29 * 16 ) // hardcoded, I know... { - return; + return true; } } } @@ -492,6 +496,7 @@ void actTrapPermanent(Entity* my) } } } + return true; } //This is called when the switch is toggled by the player. @@ -716,22 +721,22 @@ list_t* Entity::getPowerableNeighbors() return return_val; } -void actSoundSource(Entity* my) +bool actSoundSource(Entity* my) { if ( !my ) { - return; + return false; } - my->actSoundSource(); + return my->actSoundSource(); } -void Entity::actSoundSource() +bool Entity::actSoundSource() { #ifdef SOUND if ( multiplayer == CLIENT ) { - return; + return true; } if ( soundSourceDelay > 0 && soundSourceDelayCounter == 0 ) @@ -747,7 +752,7 @@ void Entity::actSoundSource() --soundSourceDelayCounter; if ( soundSourceDelayCounter != 0 ) { - return; + return true; } } if ( !soundSourceFired ) @@ -781,27 +786,28 @@ void Entity::actSoundSource() } } #endif // SOUND + return true; } #define SIGNALTIMER_DELAYCOUNT skill[6] #define SIGNALTIMER_TIMERCOUNT skill[7] #define SIGNALTIMER_REPEATCOUNT skill[8] -void actSignalTimer(Entity* my) +bool actSignalTimer(Entity* my) { if ( !my ) { - return; + return false; } - my->actSignalTimer(); + return my->actSignalTimer(); } -void Entity::actSignalTimer() +bool Entity::actSignalTimer() { if ( multiplayer == CLIENT ) { - return; + return true; } int tx = x / 16; @@ -824,7 +830,7 @@ void Entity::actSignalTimer() --SIGNALTIMER_DELAYCOUNT; if ( SIGNALTIMER_DELAYCOUNT != 0 ) { - return; + return true; } } if ( switch_power == SWITCH_UNPOWERED ) @@ -847,7 +853,7 @@ void Entity::actSignalTimer() --SIGNALTIMER_TIMERCOUNT; if ( SIGNALTIMER_TIMERCOUNT != 0 ) { - return; + return true; } } if ( switch_power == SWITCH_POWERED ) @@ -967,6 +973,8 @@ void Entity::actSignalTimer() } list_FreeAll(neighbors); //Free the list. free(neighbors); + return false; } } -} \ No newline at end of file + return true; +} diff --git a/src/menu.cpp b/src/menu.cpp index f9d549fcc..86aed8d54 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -10839,7 +10839,9 @@ void buttonOpenCharacterCreationWindow(button_t* my) void buttonLoadSingleplayerGame(button_t* button) { loadGameSaveShowRectangle = 0; - savegamesList.clear(); + if (button) { + savegamesList.clear(); + } loadingsavegame = getSaveGameUniqueGameKey(true); int mul = getSaveGameType(true); @@ -10933,7 +10935,9 @@ void buttonLoadSingleplayerGame(button_t* button) void buttonLoadMultiplayerGame(button_t* button) { loadGameSaveShowRectangle = 0; - savegamesList.clear(); + if (button) { + savegamesList.clear(); + } loadingsavegame = getSaveGameUniqueGameKey(false); int mul = getSaveGameType(false); diff --git a/src/monster.hpp b/src/monster.hpp index 6780bdc98..9aba477b2 100644 --- a/src/monster.hpp +++ b/src/monster.hpp @@ -350,33 +350,33 @@ void initLichFire(Entity* my, Stat* myStats); void initLichIce(Entity* my, Stat* myStats); //--act*Limb functions-- -void actHumanLimb(Entity* my); -void actGoblinLimb(Entity* my); -void actScorpionTail(Entity* my); -void actSuccubusLimb(Entity* my); -void actTrollLimb(Entity* my); -void actShopkeeperLimb(Entity* my); -void actSkeletonLimb(Entity* my); -void actMinotaurLimb(Entity* my); -void actGhoulLimb(Entity* my); -void actDemonLimb(Entity* my); -void actSpiderLimb(Entity* my); -void actLichLimb(Entity* my); -void actImpLimb(Entity* my); -void actGnomeLimb(Entity* my); -void actDevilLimb(Entity* my); -void actAutomatonLimb(Entity* my); -void actCockatriceLimb(Entity* my); -void actCrystalgolemLimb(Entity* my); -void actKoboldLimb(Entity* my); -void actShadowLimb(Entity* my); -void actVampireLimb(Entity* my); -void actIncubusLimb(Entity* my); -void actInsectoidLimb(Entity* my); -void actGoatmanLimb(Entity* my); -void actScarabLimb(Entity* my); -void actLichFireLimb(Entity* my); -void actLichIceLimb(Entity* my); +bool actHumanLimb(Entity* my); +bool actGoblinLimb(Entity* my); +bool actScorpionTail(Entity* my); +bool actSuccubusLimb(Entity* my); +bool actTrollLimb(Entity* my); +bool actShopkeeperLimb(Entity* my); +bool actSkeletonLimb(Entity* my); +bool actMinotaurLimb(Entity* my); +bool actGhoulLimb(Entity* my); +bool actDemonLimb(Entity* my); +bool actSpiderLimb(Entity* my); +bool actLichLimb(Entity* my); +bool actImpLimb(Entity* my); +bool actGnomeLimb(Entity* my); +bool actDevilLimb(Entity* my); +bool actAutomatonLimb(Entity* my); +bool actCockatriceLimb(Entity* my); +bool actCrystalgolemLimb(Entity* my); +bool actKoboldLimb(Entity* my); +bool actShadowLimb(Entity* my); +bool actVampireLimb(Entity* my); +bool actIncubusLimb(Entity* my); +bool actInsectoidLimb(Entity* my); +bool actGoatmanLimb(Entity* my); +bool actScarabLimb(Entity* my); +bool actLichFireLimb(Entity* my); +bool actLichIceLimb(Entity* my); //--*Die functions-- void humanDie(Entity* my); @@ -441,16 +441,16 @@ void lichFireAnimate(Entity* my, Stat* myStats, double dist); void lichIceAnimate(Entity* my, Stat* myStats, double dist); //--misc functions-- -void actMinotaurTrap(Entity* my); -void actMinotaurTimer(Entity* my); -void actMinotaurCeilingBuster(Entity* my); -void actDemonCeilingBuster(Entity* my); +bool actMinotaurTrap(Entity* my); +bool actMinotaurTimer(Entity* my); +bool actMinotaurCeilingBuster(Entity* my); +bool actDemonCeilingBuster(Entity* my); -void actDevilTeleport(Entity* my); +bool actDevilTeleport(Entity* my); void createMinotaurTimer(Entity* entity, map_t* map); -void actSummonTrap(Entity* my); +bool actSummonTrap(Entity* my); int monsterCurve(int level); bool forceFollower(Entity& leader, Entity& follower); @@ -661,4 +661,4 @@ static const int LICH_ALLY_DEAD = 1; //--Lich Battle States-- static const int LICH_BATTLE_IMMOBILE = -1; -static const int LICH_BATTLE_READY = 0; \ No newline at end of file +static const int LICH_BATTLE_READY = 0; diff --git a/src/monster_automaton.cpp b/src/monster_automaton.cpp index 7f88379dc..31716b8b4 100644 --- a/src/monster_automaton.cpp +++ b/src/monster_automaton.cpp @@ -484,9 +484,9 @@ void initAutomaton(Entity* my, Stat* myStats) } } -void actAutomatonLimb(Entity* my) +bool actAutomatonLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void automatonDie(Entity* my) diff --git a/src/monster_cockatrice.cpp b/src/monster_cockatrice.cpp index 52dcae265..cc61b737f 100644 --- a/src/monster_cockatrice.cpp +++ b/src/monster_cockatrice.cpp @@ -274,9 +274,9 @@ void initCockatrice(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actCockatriceLimb(Entity* my) +bool actCockatriceLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void cockatriceDie(Entity* my) diff --git a/src/monster_crystalgolem.cpp b/src/monster_crystalgolem.cpp index 1d456a7ee..96fb72a42 100644 --- a/src/monster_crystalgolem.cpp +++ b/src/monster_crystalgolem.cpp @@ -241,9 +241,9 @@ void initCrystalgolem(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actCrystalgolemLimb(Entity* my) +bool actCrystalgolemLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void crystalgolemDie(Entity* my) diff --git a/src/monster_demon.cpp b/src/monster_demon.cpp index da5572dd2..166c8a7f5 100644 --- a/src/monster_demon.cpp +++ b/src/monster_demon.cpp @@ -219,9 +219,9 @@ void initDemon(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actDemonLimb(Entity* my) +bool actDemonLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void demonDie(Entity* my) @@ -586,7 +586,7 @@ void demonMoveBodyparts(Entity* my, Stat* myStats, double dist) } } -void actDemonCeilingBuster(Entity* my) +bool actDemonCeilingBuster(Entity* my) { double x, y; @@ -606,11 +606,11 @@ void actDemonCeilingBuster(Entity* my) { my->attack(MONSTER_POSE_MELEE_WINDUP2, 0, nullptr); } - return; + return true; } else if ( my->monsterAttack == MONSTER_POSE_MELEE_WINDUP2 ) { - return; + return true; } map.tiles[index] = 0; if ( multiplayer != CLIENT ) @@ -663,4 +663,5 @@ void actDemonCeilingBuster(Entity* my) } } } + return true; } diff --git a/src/monster_devil.cpp b/src/monster_devil.cpp index 6cd8ab366..22581fb92 100644 --- a/src/monster_devil.cpp +++ b/src/monster_devil.cpp @@ -156,9 +156,9 @@ void initDevil(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actDevilLimb(Entity* my) +bool actDevilLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void devilDie(Entity* my) @@ -611,8 +611,9 @@ void devilMoveBodyparts(Entity* my, Stat* myStats, double dist) } } -void actDevilTeleport(Entity* my) +bool actDevilTeleport(Entity* my) { // dummy function my->flags[PASSABLE] = true; + return true; } diff --git a/src/monster_ghoul.cpp b/src/monster_ghoul.cpp index 1f26e7ae3..58ab8486e 100644 --- a/src/monster_ghoul.cpp +++ b/src/monster_ghoul.cpp @@ -251,9 +251,9 @@ void initGhoul(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actGhoulLimb(Entity* my) +bool actGhoulLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void ghoulDie(Entity* my) diff --git a/src/monster_gnome.cpp b/src/monster_gnome.cpp index 5ae1911b6..cf173a657 100644 --- a/src/monster_gnome.cpp +++ b/src/monster_gnome.cpp @@ -338,9 +338,9 @@ void initGnome(Entity* my, Stat* myStats) } } -void actGnomeLimb(Entity* my) +bool actGnomeLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void gnomeDie(Entity* my) diff --git a/src/monster_goatman.cpp b/src/monster_goatman.cpp index e0e666e0e..4e9bd6d73 100644 --- a/src/monster_goatman.cpp +++ b/src/monster_goatman.cpp @@ -686,9 +686,9 @@ void initGoatman(Entity* my, Stat* myStats) } } -void actGoatmanLimb(Entity* my) +bool actGoatmanLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void goatmanDie(Entity* my) diff --git a/src/monster_goblin.cpp b/src/monster_goblin.cpp index 85c245321..c83fed7f2 100644 --- a/src/monster_goblin.cpp +++ b/src/monster_goblin.cpp @@ -443,9 +443,9 @@ void initGoblin(Entity* my, Stat* myStats) } } -void actGoblinLimb(Entity* my) +bool actGoblinLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void goblinDie(Entity* my) diff --git a/src/monster_human.cpp b/src/monster_human.cpp index d36703d65..dbded0456 100644 --- a/src/monster_human.cpp +++ b/src/monster_human.cpp @@ -779,9 +779,9 @@ void initHuman(Entity* my, Stat* myStats) } } -void actHumanLimb(Entity* my) +bool actHumanLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void humanDie(Entity* my) diff --git a/src/monster_imp.cpp b/src/monster_imp.cpp index 9f250a865..308e656b2 100644 --- a/src/monster_imp.cpp +++ b/src/monster_imp.cpp @@ -236,9 +236,9 @@ void initImp(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actImpLimb(Entity* my) +bool actImpLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void impDie(Entity* my) diff --git a/src/monster_incubus.cpp b/src/monster_incubus.cpp index cc992b2a6..1b01c7179 100644 --- a/src/monster_incubus.cpp +++ b/src/monster_incubus.cpp @@ -351,9 +351,9 @@ void initIncubus(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actIncubusLimb(Entity* my) +bool actIncubusLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void incubusDie(Entity* my) diff --git a/src/monster_insectoid.cpp b/src/monster_insectoid.cpp index f244cd6e6..4e51cd870 100644 --- a/src/monster_insectoid.cpp +++ b/src/monster_insectoid.cpp @@ -630,9 +630,9 @@ void initInsectoid(Entity* my, Stat* myStats) } } -void actInsectoidLimb(Entity* my) +bool actInsectoidLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void insectoidDie(Entity* my) diff --git a/src/monster_kobold.cpp b/src/monster_kobold.cpp index c0270d842..0f7b57585 100644 --- a/src/monster_kobold.cpp +++ b/src/monster_kobold.cpp @@ -450,9 +450,9 @@ void initKobold(Entity* my, Stat* myStats) } } -void actKoboldLimb(Entity* my) +bool actKoboldLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void koboldDie(Entity* my) diff --git a/src/monster_lich.cpp b/src/monster_lich.cpp index 218d9d42c..1c3008689 100644 --- a/src/monster_lich.cpp +++ b/src/monster_lich.cpp @@ -268,9 +268,9 @@ void lichDie(Entity* my) return; } -void actLichLimb(Entity* my) +bool actLichLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void lichAnimate(Entity* my, double dist) diff --git a/src/monster_lichfire.cpp b/src/monster_lichfire.cpp index b709d53b2..e7e883bd4 100644 --- a/src/monster_lichfire.cpp +++ b/src/monster_lichfire.cpp @@ -262,9 +262,9 @@ void lichFireDie(Entity* my) return; } -void actLichFireLimb(Entity* my) +bool actLichFireLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void lichFireAnimate(Entity* my, Stat* myStats, double dist) @@ -1304,4 +1304,4 @@ void Entity::lichFireSummonMonster(Monster creature) serverSpawnMiscParticlesAtLocation(spawn_x, spawn_y, 0, PARTICLE_EFFECT_SUMMON_MONSTER, 174); } } -} \ No newline at end of file +} diff --git a/src/monster_lichice.cpp b/src/monster_lichice.cpp index cfafc0c2e..b4724740b 100644 --- a/src/monster_lichice.cpp +++ b/src/monster_lichice.cpp @@ -263,9 +263,9 @@ void lichIceDie(Entity* my) return; } -void actLichIceLimb(Entity* my) +bool actLichIceLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void lichIceAnimate(Entity* my, Stat* myStats, double dist) @@ -1476,4 +1476,4 @@ void Entity::lichIceSummonMonster(Monster creature) serverSpawnMiscParticlesAtLocation(spawn_x, spawn_y, 0, PARTICLE_EFFECT_SUMMON_MONSTER, 174); } } -} \ No newline at end of file +} diff --git a/src/monster_minotaur.cpp b/src/monster_minotaur.cpp index 12005d76f..7044a20bb 100644 --- a/src/monster_minotaur.cpp +++ b/src/monster_minotaur.cpp @@ -239,9 +239,9 @@ void initMinotaur(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actMinotaurLimb(Entity* my) +bool actMinotaurLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void minotaurDie(Entity* my) @@ -599,11 +599,11 @@ void minotaurMoveBodyparts(Entity* my, Stat* myStats, double dist) #define MINOTAURTRAP_FIRED my->skill[0] -void actMinotaurTrap(Entity* my) +bool actMinotaurTrap(Entity* my) { if ( !my->skill[28] ) { - return; + return false; } // received on signal @@ -628,12 +628,13 @@ void actMinotaurTrap(Entity* my) } } } + return true; } #define MINOTAURTIMER_LIFE my->skill[0] #define MINOTAURTIMER_ACTIVE my->skill[1] -void actMinotaurTimer(Entity* my) +bool actMinotaurTimer(Entity* my) { node_t* node; @@ -719,11 +720,12 @@ void actMinotaurTimer(Entity* my) } } list_RemoveNode(my->mynode); - return; + return false; } + return true; } -void actMinotaurCeilingBuster(Entity* my) +bool actMinotaurCeilingBuster(Entity* my) { double x, y; @@ -774,11 +776,11 @@ void actMinotaurCeilingBuster(Entity* my) { my->attack(MONSTER_POSE_MELEE_WINDUP2, 0, nullptr); } - return; + return true; } else if ( my->monsterAttack == MONSTER_POSE_MELEE_WINDUP2 ) { - return; + return true; } map.tiles[index] = 0; if ( multiplayer != CLIENT ) @@ -932,9 +934,11 @@ void actMinotaurCeilingBuster(Entity* my) } } } + return false; } } } + return true; } void createMinotaurTimer(Entity* entity, map_t* map) diff --git a/src/monster_scarab.cpp b/src/monster_scarab.cpp index d3461897e..5b2a09c92 100644 --- a/src/monster_scarab.cpp +++ b/src/monster_scarab.cpp @@ -502,9 +502,9 @@ void scarabAnimate(Entity* my, Stat* myStats, double dist) } } -void actScarabLimb(Entity* my) +bool actScarabLimb(Entity* my) { - my->actMonsterLimb(true); //Can create light, but can't hold a lightsource. + return my->actMonsterLimb(true); //Can create light, but can't hold a lightsource. } void scarabDie(Entity* my) diff --git a/src/monster_scorpion.cpp b/src/monster_scorpion.cpp index 6f751464f..b18952daf 100644 --- a/src/monster_scorpion.cpp +++ b/src/monster_scorpion.cpp @@ -143,7 +143,7 @@ void scorpionDie(Entity* my) list_RemoveNode(my->mynode); return; } -void actScorpionTail(Entity* my) +bool actScorpionTail(Entity* my) { int i; @@ -151,7 +151,7 @@ void actScorpionTail(Entity* my) if ( (parent = uidToEntity(my->skill[2])) == NULL ) { list_RemoveNode(my->mynode); - return; + return false; } if ( multiplayer != CLIENT ) @@ -171,7 +171,7 @@ void actScorpionTail(Entity* my) } } } - return; + return true; } void scorpionAnimate(Entity* my, double dist) diff --git a/src/monster_shadow.cpp b/src/monster_shadow.cpp index b0039fc86..ef543f7de 100644 --- a/src/monster_shadow.cpp +++ b/src/monster_shadow.cpp @@ -303,9 +303,9 @@ void initShadow(Entity* my, Stat* myStats) } } -void actShadowLimb(Entity* my) +bool actShadowLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void shadowDie(Entity* my) diff --git a/src/monster_shared.cpp b/src/monster_shared.cpp index e78f4ccd9..729e48bcd 100644 --- a/src/monster_shared.cpp +++ b/src/monster_shared.cpp @@ -290,14 +290,14 @@ int Entity::getMonsterTypeFromSprite() return NOTHING; } -void Entity::actMonsterLimb(bool processLight) +bool Entity::actMonsterLimb(bool processLight) { //If no longer part of a monster, delete the limb. Entity *parentEnt = nullptr; if ( (parentEnt = uidToEntity(skill[2])) == nullptr ) { list_RemoveNode(mynode); - return; + return false; } //Do something magical beyond my comprehension. @@ -359,6 +359,7 @@ void Entity::actMonsterLimb(bool processLight) { monsterEntityRenderAsTelepath = 0; } + return true; } void Entity::removeMonsterDeathNodes() diff --git a/src/monster_shopkeeper.cpp b/src/monster_shopkeeper.cpp index 6ce14304b..2aaba155d 100644 --- a/src/monster_shopkeeper.cpp +++ b/src/monster_shopkeeper.cpp @@ -618,9 +618,9 @@ void initShopkeeper(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actShopkeeperLimb(Entity* my) +bool actShopkeeperLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void shopkeeperDie(Entity* my) diff --git a/src/monster_skeleton.cpp b/src/monster_skeleton.cpp index 1bad231d1..cea1aab9d 100644 --- a/src/monster_skeleton.cpp +++ b/src/monster_skeleton.cpp @@ -406,9 +406,9 @@ void initSkeleton(Entity* my, Stat* myStats) } } -void actSkeletonLimb(Entity* my) +bool actSkeletonLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void skeletonDie(Entity* my) diff --git a/src/monster_spider.cpp b/src/monster_spider.cpp index 1daab28d1..d144441b2 100644 --- a/src/monster_spider.cpp +++ b/src/monster_spider.cpp @@ -211,9 +211,9 @@ void spiderDie(Entity* my) return; } -void actSpiderLimb(Entity* my) +bool actSpiderLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void spiderMoveBodyparts(Entity* my, Stat* myStats, double dist) diff --git a/src/monster_succubus.cpp b/src/monster_succubus.cpp index b94750335..24310ef65 100644 --- a/src/monster_succubus.cpp +++ b/src/monster_succubus.cpp @@ -245,9 +245,9 @@ void initSuccubus(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actSuccubusLimb(Entity* my) +bool actSuccubusLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void succubusDie(Entity* my) @@ -791,4 +791,4 @@ void Entity::succubusChooseWeapon(const Entity* target, double dist) } } } -} \ No newline at end of file +} diff --git a/src/monster_troll.cpp b/src/monster_troll.cpp index a87544ba4..bf9bde9dc 100644 --- a/src/monster_troll.cpp +++ b/src/monster_troll.cpp @@ -213,9 +213,9 @@ void initTroll(Entity* my, Stat* myStats) my->bodyparts.push_back(entity); } -void actTrollLimb(Entity* my) +bool actTrollLimb(Entity* my) { - my->actMonsterLimb(); + return my->actMonsterLimb(); } void trollDie(Entity* my) diff --git a/src/monster_vampire.cpp b/src/monster_vampire.cpp index 0e24966e0..7ffa6df60 100644 --- a/src/monster_vampire.cpp +++ b/src/monster_vampire.cpp @@ -462,9 +462,9 @@ void initVampire(Entity* my, Stat* myStats) } } -void actVampireLimb(Entity* my) +bool actVampireLimb(Entity* my) { - my->actMonsterLimb(true); + return my->actMonsterLimb(true); } void vampireDie(Entity* my)