00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <actions/TankSay.h>
00022 #ifndef S3D_SERVER
00023 #include <sprites/TalkRenderer.h>
00024 #include <sprites/ExplosionTextures.h>
00025 #endif
00026 #include <tank/TankContainer.h>
00027 #include <tank/TankPosition.h>
00028 #include <tank/TankAvatar.h>
00029 #include <engine/ScorchedContext.h>
00030 #include <engine/ActionController.h>
00031 #include <common/Defines.h>
00032 #include <common/ChannelManager.h>
00033
00034 TankSay::TankSay(unsigned int playerId, const LangString &text) :
00035 ActionReferenced("TankSay"),
00036 playerId_(playerId), text_(text)
00037 {
00038
00039 }
00040
00041 TankSay::~TankSay()
00042 {
00043 }
00044
00045 void TankSay::init()
00046 {
00047 Tank *tank =
00048 context_->getTankContainer().getTankById(playerId_);
00049 if (tank)
00050 {
00051 #ifndef S3D_SERVER
00052 if (!context_->getServerMode())
00053 {
00054
00055 Vector white(1.0f, 1.0f, 1.0f);
00056 TalkRenderer *talk = new TalkRenderer(
00057 tank->getPosition().getTankTurretPosition().asVector(),
00058 white);
00059 context_->getActionController().addAction(new SpriteAction(talk));
00060
00061 ChannelText text("general", text_);
00062 text.setSrcPlayerId(playerId_);
00063 ChannelManager::showText(*context_, text);
00064 }
00065 #endif // #ifndef S3D_SERVER
00066 }
00067 }
00068
00069 void TankSay::simulate(fixed frameTime, bool &remove)
00070 {
00071 remove = true;
00072 Action::simulate(frameTime, remove);
00073 }