diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-02-11 18:30:58 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-02-11 18:30:58 +0000 |
commit | ccc550d7f685a1c776888cf05012b868daa2bee8 (patch) | |
tree | ccf1a2104793964394a18be369b1ee9c5650a4d0 /goodies | |
parent | 365266ba9d864986ff3167a35884bb6d9e6f5b1c (diff) |
INTEGRATION: CWS pj17 (1.1.1.1.264); FILE MERGED
2005/02/10 10:45:33 gh 1.1.1.1.264.3: more tuning to make it work nicely under windows too
2005/02/09 09:29:37 gh 1.1.1.1.264.2: finetuning
2005/02/07 17:05:49 gh 1.1.1.1.264.1: some fixes for 32 bit random numbers + enhanced invisible
Diffstat (limited to 'goodies')
-rw-r--r-- | goodies/source/inv/monst.cxx | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/goodies/source/inv/monst.cxx b/goodies/source/inv/monst.cxx index e7b4b1a30f2a..6eb48c1c4c09 100644 --- a/goodies/source/inv/monst.cxx +++ b/goodies/source/inv/monst.cxx @@ -2,9 +2,9 @@ * * $RCSfile: monst.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:30:10 $ + * last change: $Author: hr $ $Date: 2005-02-11 19:30:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,7 +106,7 @@ Gegner::Gegner(Fighter* pFig, Bombe* pBom, ResMgr* pRes) : aOutSize = pBitMonst1->GetSizePixel(); - nRandWert = 200; + SetRandWert( 100 ); } Gegner::~Gegner() @@ -298,10 +298,10 @@ void Gegner::DrawGegner(OutputDevice* pDev,Point* pStart) pDev->DrawImage(Point(pStart->X()+GegnerX(i), pStart->Y()+GegnerY(i)),*pBitMonst5b); DecDelay(i); + pBombe->InsertBombe(Point(GegnerX(i), + GegnerY(i)+aOutSize.Height()/2)); if(!GetDelay(i)) { - pBombe->InsertBombe(Point(GegnerX(i)+aOutSize.Width()/2, - GegnerY(i)+aOutSize.Height())); SetDelay(i); SetMode(i,MOVE4); } @@ -314,7 +314,10 @@ void Gegner::DrawGegner(OutputDevice* pDev,Point* pStart) if(!GetDelay(i)) { SetDelay(i); - SetMode(i,MOVE5); + if ( rand() % 5 < 2 ) + SetMode(i,MOVE3); + else + SetMode(i,MOVE5); } } if(GegMode(i) == MOVE5) @@ -323,7 +326,15 @@ void Gegner::DrawGegner(OutputDevice* pDev,Point* pStart) pStart->Y()+GegnerY(i)),*pBitMonst5); DecDelay(i); if(!GetDelay(i)) - SetMode(i,HIDE); + { + if ( rand() % 5 < 2 ) + { + SetMode(i,MOVE1); + SetDelay(i); + } + else + SetMode(i,HIDE); + } } break; @@ -338,18 +349,28 @@ void Gegner::DrawGegner(OutputDevice* pDev,Point* pStart) if(GegnerX(i) < pFighter->GetHalf() && GegnerX(i)+aOutSize.Width() > pFighter->GetHalf()) pBombe->InsertBombe(Point(pFighter->GetPoint().X(), - GegnerY(i)+aOutSize.Height())); + GegnerY(i)+aOutSize.Height()/2)); } else { int ran = rand(); - if(ran < nRandWert) + int nScaledLimit; + // NOTE: the two expressions are the same in floatingpoint but not in integer + if ( RAND_MAX < 32767 ) + nScaledLimit = GetRandWert() / (32767 / RAND_MAX); + else + nScaledLimit = GetRandWert() * (RAND_MAX / 32767); + + if(GegType(i) != GEGNER5) + { + if(ran < nScaledLimit ) + pBombe->InsertBombe(Point(GegnerX(i), + GegnerY(i)+aOutSize.Height()/2)); + } + else if(GegMode(i) == HIDE) { - if(GegType(i) != GEGNER5) - pBombe->InsertBombe(Point(GegnerX(i)+aOutSize.Width()/2, - GegnerY(i)+aOutSize.Height())); - else if(GegMode(i) == HIDE) + if(ran < (nScaledLimit *3) /2) { SetMode(i,MOVE1); SetDelay(i); |