____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"00001 // ____ _ __ 00002 // / __ )____ _____ | | / /___ ___________ 00003 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ 00004 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) 00005 // /_____/\____/____/ |__/|__/\__,_/_/ /____/ 00006 // 00007 // A futuristic real-time strategy game. 00008 // This file is part of Bos Wars. 00009 // 00011 // 00012 // (c) Copyright 1998-2005 by Lutz Sammer and Jimmy Salmon 00013 // 00014 // This program is free software; you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation; only version 2 of the License. 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU General Public License for more details. 00022 // 00023 // You should have received a copy of the GNU General Public License 00024 // along with this program; if not, write to the Free Software 00025 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00026 // 02111-1307, USA. 00027 // 00028 00030 00031 /*---------------------------------------------------------------------------- 00032 -- Includes 00033 ----------------------------------------------------------------------------*/ 00034 00035 #include <stdio.h> 00036 #include <stdlib.h> 00037 00038 #include "stratagus.h" 00039 #include "unittype.h" 00040 #include "animation.h" 00041 #include "player.h" 00042 #include "unit.h" 00043 #include "actions.h" 00044 #include "map.h" 00045 00046 /*---------------------------------------------------------------------------- 00047 -- Functions 00048 ----------------------------------------------------------------------------*/ 00049 00055 void HandleActionDie(CUnit *unit) 00056 { 00057 // 00058 // Show death animation 00059 // 00060 if (unit->Type->Animations && unit->Type->Animations->Death) { 00061 UnitShowAnimation(unit, unit->Type->Animations->Death); 00062 } else { 00063 // some units has no death animation 00064 unit->Anim.Unbreakable = 0; 00065 } 00066 00067 // 00068 // Die sequence terminated, generate corpse. 00069 // 00070 if (!unit->Anim.Unbreakable) { 00071 if (!unit->Type->CorpseType) { 00072 // We may be in the cache if we just finished out death animation 00073 // even though there is no corpse. 00074 // (unit->Type->Animations && unit->Type->Animations->Death) 00075 // Remove us from the map to be safe 00076 unit->Remove(NULL); 00077 unit->Release(); 00078 return; 00079 } 00080 00081 Assert(unit->Type->TileWidth == unit->Type->CorpseType->TileWidth && 00082 unit->Type->TileHeight == unit->Type->CorpseType->TileHeight); 00083 00084 // Update sight for new corpse 00085 // We have to unmark BEFORE changing the type. 00086 // Always do that, since types can have different vision properties. 00087 MapUnmarkUnitSight(unit); 00088 unit->Type = unit->Type->CorpseType; 00089 unit->CurrentSightRange = unit->Type->Stats[unit->Player->Index].Variables[SIGHTRANGE_INDEX].Max; 00090 MapMarkUnitSight(unit); 00091 00092 // We must be dead to get here, it we aren't we need to know why 00093 // This assert replaces and old DEBUG message "Reset to die is really needed" 00094 Assert(unit->Orders[0]->Action == UnitActionDie); 00095 00096 unit->SubAction = 0; 00097 unit->Frame = 0; 00098 UnitUpdateHeading(unit); 00099 if (unit->Type->Animations && unit->Type->Animations->Death) { 00100 UnitShowAnimation(unit, unit->Type->Animations->Death); 00101 } 00102 } 00103 } 00104
1.5.6