@@ -357,24 +357,23 @@ void GenericCAO::initialize(const std::string &data)
357
357
void GenericCAO::processInitData (const std::string &data)
358
358
{
359
359
std::istringstream is (data, std::ios::binary);
360
- int num_messages = 0 ;
361
- // version
362
- u8 version = readU8 (is);
363
- // check version
364
- if (version == 1 ) { // In PROTOCOL_VERSION 14
365
- m_name = deSerializeString (is);
366
- m_is_player = readU8 (is);
367
- m_id = readU16 (is);
368
- m_position = readV3F1000 (is);
369
- m_rotation = readV3F1000 (is);
370
- m_hp = readS16 (is);
371
- num_messages = readU8 (is);
372
- } else {
373
- errorstream<<" GenericCAO: Unsupported init data version"
374
- <<std::endl;
360
+ const u8 version = readU8 (is);
361
+
362
+ if (version < 1 ) {
363
+ errorstream << " GenericCAO: Unsupported init data version"
364
+ << std::endl;
375
365
return ;
376
366
}
377
367
368
+ // PROTOCOL_VERSION >= 37
369
+ m_name = deSerializeString (is);
370
+ m_is_player = readU8 (is);
371
+ m_id = readU16 (is);
372
+ m_position = readV3F32 (is);
373
+ m_rotation = readV3F32 (is);
374
+ m_hp = readS16 (is);
375
+ const u8 num_messages = readU8 (is);
376
+
378
377
for (int i = 0 ; i < num_messages; i++) {
379
378
std::string message = deSerializeLongString (is);
380
379
processMessage (message);
@@ -546,7 +545,8 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
546
545
m_spritenode->setMaterialFlag (video::EMF_FOG_ENABLE, true );
547
546
u8 li = m_last_light;
548
547
m_spritenode->setColor (video::SColor (255 ,li,li,li));
549
- m_spritenode->setSize (m_prop.visual_size *BS);
548
+ m_spritenode->setSize (v2f (m_prop.visual_size .X ,
549
+ m_prop.visual_size .Y ) * BS);
550
550
{
551
551
const float txs = 1.0 / 1 ;
552
552
const float tys = 1.0 / 1 ;
@@ -622,9 +622,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
622
622
m_meshnode->grab ();
623
623
mesh->drop ();
624
624
625
- m_meshnode->setScale (v3f (m_prop.visual_size .X ,
626
- m_prop.visual_size .Y ,
627
- m_prop.visual_size .X ));
625
+ m_meshnode->setScale (m_prop.visual_size );
628
626
u8 li = m_last_light;
629
627
setMeshColor (m_meshnode->getMesh (), video::SColor (255 ,li,li,li));
630
628
@@ -643,9 +641,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
643
641
m_animated_meshnode->grab ();
644
642
mesh->drop (); // The scene node took hold of it
645
643
m_animated_meshnode->animateJoints (); // Needed for some animations
646
- m_animated_meshnode->setScale (v3f (m_prop.visual_size .X ,
647
- m_prop.visual_size .Y ,
648
- m_prop.visual_size .X ));
644
+ m_animated_meshnode->setScale (m_prop.visual_size );
649
645
u8 li = m_last_light;
650
646
651
647
// set vertex colors to ensure alpha is set
@@ -683,9 +679,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
683
679
m_wield_meshnode->setItem (item, m_client,
684
680
(m_prop.visual == " wielditem" ));
685
681
686
- m_wield_meshnode->setScale (
687
- v3f (m_prop.visual_size .X / 2 , m_prop.visual_size .Y / 2 ,
688
- m_prop.visual_size .X / 2 ));
682
+ m_wield_meshnode->setScale (m_prop.visual_size / 2 .0f );
689
683
u8 li = m_last_light;
690
684
m_wield_meshnode->setColor (video::SColor (255 , li, li, li));
691
685
} else {
@@ -1393,7 +1387,7 @@ void GenericCAO::processMessage(const std::string &data)
1393
1387
} else if (cmd == GENERIC_CMD_SET_SPRITE) {
1394
1388
v2s16 p = readV2S16 (is);
1395
1389
int num_frames = readU16 (is);
1396
- float framelength = readF1000 (is);
1390
+ float framelength = readF32 (is);
1397
1391
bool select_horiz_by_yawpitch = readU8 (is);
1398
1392
1399
1393
m_tx_basepos = p;
@@ -1403,9 +1397,9 @@ void GenericCAO::processMessage(const std::string &data)
1403
1397
1404
1398
updateTexturePos ();
1405
1399
} else if (cmd == GENERIC_CMD_SET_PHYSICS_OVERRIDE) {
1406
- float override_speed = readF1000 (is);
1407
- float override_jump = readF1000 (is);
1408
- float override_gravity = readF1000 (is);
1400
+ float override_speed = readF32 (is);
1401
+ float override_jump = readF32 (is);
1402
+ float override_gravity = readF32 (is);
1409
1403
// these are sent inverted so we get true when the server sends nothing
1410
1404
bool sneak = !readU8 (is);
1411
1405
bool sneak_glitch = !readU8 (is);
@@ -1424,11 +1418,11 @@ void GenericCAO::processMessage(const std::string &data)
1424
1418
}
1425
1419
} else if (cmd == GENERIC_CMD_SET_ANIMATION) {
1426
1420
// TODO: change frames send as v2s32 value
1427
- v2f range = readV2F1000 (is);
1421
+ v2f range = readV2F32 (is);
1428
1422
if (!m_is_local_player) {
1429
1423
m_animation_range = v2s32 ((s32)range.X , (s32)range.Y );
1430
- m_animation_speed = readF1000 (is);
1431
- m_animation_blend = readF1000 (is);
1424
+ m_animation_speed = readF32 (is);
1425
+ m_animation_blend = readF32 (is);
1432
1426
// these are sent inverted so we get true when the server sends nothing
1433
1427
m_animation_loop = !readU8 (is);
1434
1428
updateAnimation ();
@@ -1437,8 +1431,8 @@ void GenericCAO::processMessage(const std::string &data)
1437
1431
if (player->last_animation == NO_ANIM)
1438
1432
{
1439
1433
m_animation_range = v2s32 ((s32)range.X , (s32)range.Y );
1440
- m_animation_speed = readF1000 (is);
1441
- m_animation_blend = readF1000 (is);
1434
+ m_animation_speed = readF32 (is);
1435
+ m_animation_blend = readF32 (is);
1442
1436
// these are sent inverted so we get true when the server sends nothing
1443
1437
m_animation_loop = !readU8 (is);
1444
1438
}
@@ -1457,12 +1451,12 @@ void GenericCAO::processMessage(const std::string &data)
1457
1451
}
1458
1452
}
1459
1453
} else if (cmd == GENERIC_CMD_SET_ANIMATION_SPEED) {
1460
- m_animation_speed = readF1000 (is);
1454
+ m_animation_speed = readF32 (is);
1461
1455
updateAnimationSpeed ();
1462
1456
} else if (cmd == GENERIC_CMD_SET_BONE_POSITION) {
1463
1457
std::string bone = deSerializeString (is);
1464
- v3f position = readV3F1000 (is);
1465
- v3f rotation = readV3F1000 (is);
1458
+ v3f position = readV3F32 (is);
1459
+ v3f rotation = readV3F32 (is);
1466
1460
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
1467
1461
1468
1462
updateBonePosition ();
@@ -1482,8 +1476,8 @@ void GenericCAO::processMessage(const std::string &data)
1482
1476
}
1483
1477
1484
1478
m_attachment_bone = deSerializeString (is);
1485
- m_attachment_position = readV3F1000 (is);
1486
- m_attachment_rotation = readV3F1000 (is);
1479
+ m_attachment_position = readV3F32 (is);
1480
+ m_attachment_rotation = readV3F32 (is);
1487
1481
1488
1482
// localplayer itself can't be attached to localplayer
1489
1483
if (!m_is_local_player) {
@@ -1510,7 +1504,7 @@ void GenericCAO::processMessage(const std::string &data)
1510
1504
// As there is no definition, make a smoke puff
1511
1505
ClientSimpleObject *simple = createSmokePuff (
1512
1506
m_smgr, m_env, m_position,
1513
- m_prop.visual_size * BS);
1507
+ v2f ( m_prop.visual_size . X , m_prop. visual_size . Y ) * BS);
1514
1508
m_env->addSimpleObject (simple);
1515
1509
} else if (m_reset_textures_timer < 0 ) {
1516
1510
// TODO: Execute defined fast response
@@ -1581,7 +1575,7 @@ bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem,
1581
1575
// As there is no definition, make a smoke puff
1582
1576
ClientSimpleObject *simple = createSmokePuff (
1583
1577
m_smgr, m_env, m_position,
1584
- m_prop.visual_size * BS);
1578
+ v2f ( m_prop.visual_size . X , m_prop. visual_size . Y ) * BS);
1585
1579
m_env->addSimpleObject (simple);
1586
1580
}
1587
1581
// TODO: Execute defined fast response
0 commit comments