@@ -318,7 +318,7 @@ void Map::drawTerrain(Surface *surface)
318318 {
319319 if (_viewHeight == itZ)
320320 {
321- if (_cursorType == CT_NORMAL )
321+ if (_cursorType == CT_NORMAL || _cursorType == CT_THROW )
322322 {
323323 if (unit)
324324 frameNumber = 1 ; // yellow box
@@ -400,42 +400,63 @@ void Map::drawTerrain(Surface *surface)
400400 // check if we got bullet
401401 if (_projectile)
402402 {
403+ Surface *item = 0 ;
404+ if (_projectile->getItem ())
405+ item = _res->getSurfaceSet (" FLOOROB.PCK" )->getFrame (_projectile->getItem ()->getRules ()->getFloorSprite ());
403406 // draw bullet on the correct tile
404407 if (itX >= bulletLowX && itX <= bulletHighX && itY >= bulletLowY && itY <= bulletHighY)
405408 {
406409 if (itZ == 0 )
407410 {
408411 // draw shadow on the floor
409- for ( int i = 1 ; i <= _projectile-> getParticle ( 0 ); i++ )
412+ if (item )
410413 {
411- if (_projectile->getParticle (i) != 0xFF )
414+ void ();
415+ }
416+ else
417+ {
418+ for (int i = 1 ; i <= _projectile->getParticle (0 ); i++)
412419 {
413- Position voxelPos = _projectile->getPosition (1 -i);
414- voxelPos.z = 0 ;
415- if (voxelPos.x / 16 == mapPosition.x &&
416- voxelPos.y / 16 == mapPosition.y )
420+ if (_projectile->getParticle (i) != 0xFF )
417421 {
418- convertVoxelToScreen (voxelPos, &bulletPositionScreen);
419- _bulletShadow[_projectile->getParticle (i)]->setX (bulletPositionScreen.x );
420- _bulletShadow[_projectile->getParticle (i)]->setY (bulletPositionScreen.y );
421- _bulletShadow[_projectile->getParticle (i)]->blit (surface);
422+ Position voxelPos = _projectile->getPosition (1 -i);
423+ voxelPos.z = 0 ;
424+ if (voxelPos.x / 16 == mapPosition.x &&
425+ voxelPos.y / 16 == mapPosition.y )
426+ {
427+ convertVoxelToScreen (voxelPos, &bulletPositionScreen);
428+ _bulletShadow[_projectile->getParticle (i)]->setX (bulletPositionScreen.x );
429+ _bulletShadow[_projectile->getParticle (i)]->setY (bulletPositionScreen.y );
430+ _bulletShadow[_projectile->getParticle (i)]->blit (surface);
431+ }
422432 }
423433 }
424434 }
425435 }
426436
427- for ( int i = 1 ; i <= _projectile-> getParticle ( 0 ); i++ )
437+ if (item )
428438 {
429- if (_projectile->getParticle (i) != 0xFF )
439+ Position voxelPos = _projectile->getPosition ();
440+ convertVoxelToScreen (voxelPos, &bulletPositionScreen);
441+ item->setX (bulletPositionScreen.x - item->getWidth ()/2 );
442+ item->setY (bulletPositionScreen.y - item->getHeight ()/2 );
443+ item->blit (surface);
444+ }
445+ else
446+ {
447+ for (int i = 1 ; i <= _projectile->getParticle (0 ); i++)
430448 {
431- Position voxelPos = _projectile->getPosition (1 -i);
432- if (voxelPos.x / 16 == mapPosition.x &&
433- voxelPos.y / 16 == mapPosition.y )
449+ if (_projectile->getParticle (i) != 0xFF )
434450 {
435- convertVoxelToScreen (voxelPos, &bulletPositionScreen);
436- _bullet[_projectile->getParticle (i)]->setX (bulletPositionScreen.x );
437- _bullet[_projectile->getParticle (i)]->setY (bulletPositionScreen.y );
438- _bullet[_projectile->getParticle (i)]->blit (surface);
451+ Position voxelPos = _projectile->getPosition (1 -i);
452+ if (voxelPos.x / 16 == mapPosition.x &&
453+ voxelPos.y / 16 == mapPosition.y )
454+ {
455+ convertVoxelToScreen (voxelPos, &bulletPositionScreen);
456+ _bullet[_projectile->getParticle (i)]->setX (bulletPositionScreen.x );
457+ _bullet[_projectile->getParticle (i)]->setY (bulletPositionScreen.y );
458+ _bullet[_projectile->getParticle (i)]->blit (surface);
459+ }
439460 }
440461 }
441462 }
@@ -461,7 +482,7 @@ void Map::drawTerrain(Surface *surface)
461482 {
462483 if (_viewHeight == itZ)
463484 {
464- if (_cursorType == CT_NORMAL )
485+ if (_cursorType == CT_NORMAL || _cursorType == CT_THROW )
465486 {
466487 if (unit)
467488 frameNumber = 4 ; // yellow box
@@ -484,6 +505,13 @@ void Map::drawTerrain(Surface *surface)
484505 frame->setX (screenPosition.x );
485506 frame->setY (screenPosition.y );
486507 frame->blit (surface);
508+ if (_cursorType == CT_THROW )
509+ {
510+ frame = _res->getSurfaceSet (" CURSOR.PCK" )->getFrame (15 + (_animFrame / 4 ));
511+ frame->setX (screenPosition.x );
512+ frame->setY (screenPosition.y );
513+ frame->blit (surface);
514+ }
487515 }
488516
489517 tile = _save->getTile (mapPosition);
0 commit comments