aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/menu_header.png
blob: 0769a01866fae7a78096cca79fd9a8e830317d5b (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 7f 00 00 00 10 08 06 00 00 00 3f 1f a0 .PNG........IHDR.............?..
0020 9c 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 .....bKGD..............pHYs.....
0040 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e0 03 14 0f 05 1c 20 61 e4 0d 00 00 00 1d 69 ............tIME........a......i
0060 54 58 74 43 6f 6d 6d 65 6e 74 00 00 00 00 00 43 72 65 61 74 65 64 20 77 69 74 68 20 47 49 4d 50 TXtComment.....Created.with.GIMP
0080 64 2e 65 07 00 00 05 c0 49 44 41 54 58 c3 ed 59 4b 4f 1b 57 14 fe ee 68 e2 07 f6 8c a1 91 c0 4e d.e.....IDATX..YKO.W...h.......N
00a0 17 e9 82 92 44 4d d4 3d 55 97 ad 2a b5 52 d7 55 1e 55 fe 42 16 b8 92 13 84 f2 58 24 8b 2e ab 34 ....DM.=U..*.R.U.U.B......X$...4
00c0 51 d4 a4 01 45 69 a5 46 8d 54 15 85 86 f0 0a 84 52 0b 1a a8 14 5e 41 a4 81 31 c6 a8 78 66 6c 8f Q...Ei.F.T......R....^A..1..xfl.
00e0 c7 c1 d3 05 9e cb 1d 7b c6 50 33 52 51 9b b3 f2 e3 f8 fb ce 39 73 5e f7 9a 0c 3f 7a 68 cc cc cf .......{.P3RQ.......9s^...?zh...
0100 83 95 84 24 21 7a b6 9d b0 9f 0d f7 fe 62 cc cc cd d1 f7 84 e3 90 58 49 20 1a 6b 27 23 7d bd 15 ...$!z.......b........XI..k'#}..
0120 18 c6 c6 06 00 60 25 99 44 f4 ac bd 8e 9b 3c a6 e8 ba 0e 8f c7 63 f9 ec 35 86 3d 06 ff 62 69 09 .....`%.D.....<......c..5.=..bi.
0140 e3 13 bf 43 51 14 08 82 80 bc a6 c1 e3 f5 e2 f2 c5 f3 86 f9 60 c6 86 87 8c bb 3f dc 03 00 c8 e9 ...CQ...............`.....?.....
0160 34 42 f5 f5 00 80 c9 a9 3f 10 8d b5 c3 09 43 4e a7 31 3d 3b 8b e8 59 67 1d 96 07 00 fe 5c 96 30 4B......?.....CN.1=;..Yg.....\.0
0180 fe 74 f2 1f f3 00 80 18 0a 59 9c 7c 8d 51 1d 83 4f ad ae 62 61 61 01 3e bf 1f 6a 26 03 00 a8 f3 .t.......Y.|.Q..O..baa.>..j&....
01a0 f9 20 a7 d3 b8 7c f1 bc f1 7e 6b 2b cc 07 af 28 0a 08 c7 41 4a 24 00 00 69 79 93 c4 09 83 95 ed .....|...~k+...(...AJ$..iy......
01c0 78 d8 04 a8 95 47 4e a7 a9 c3 af 31 b6 c7 e0 01 c0 e7 f7 23 18 08 c0 30 8c cd d6 51 2c 22 93 cd x....GN....1.......#...0...Q,"..
01e0 22 3e 3e 81 f8 f8 04 82 c1 20 00 20 93 cd 5a 1e e8 c6 ab 57 f4 b5 13 86 ae eb db ea c4 c7 27 70 ">>...........Z....W..........'p
0200 a9 e3 9c 11 eb b8 40 34 2d 57 13 0f db d2 6a b5 f5 ff 86 c1 ef f3 7a 01 80 66 8e 99 3d 91 48 04 ......@4-W....j.......z..f..=.H.
0220 72 3a 4d 7f 0c 00 81 ba 3a 0b 40 5d e9 fd c8 d8 18 f6 79 f6 55 60 3c 9d 9a 42 a1 50 00 00 6c c7 r:M.....:.@]......y.U`<..B.P..l.
0240 33 bf b0 88 cb 97 ce 1b e1 a6 b0 23 8f 1d c6 6f f1 38 de 3a 78 10 b9 5c 0e 84 58 d6 07 6b cb 53 3..........#...o.8.:x..\..X..k.S
0260 54 6a eb fc f3 e7 96 ef 8e 1e 39 52 e1 6f ff e0 10 c2 4d 8d b6 18 6e d8 b1 17 7c e1 bd 1e 0f 82 Tj........9R.o....M...n...|.....
0280 81 c0 66 d6 30 d9 c3 ce 07 a1 54 f9 8a aa 42 96 65 18 c5 a2 65 9e 74 76 dd 21 b7 6e 5c 37 06 06 ..f.0.....T...B.e...e.tv.!.n\7..
02a0 87 2c 18 6f 34 34 60 f8 c9 28 01 80 9d f0 a8 6a 16 72 9d 02 51 14 6d 79 ec 30 9a 1a 1b f1 f0 51 .,.o44`..(.....j.r..Q.my.0.....Q
02c0 9f 73 a4 ca a4 b3 eb 4e 85 ee cd 6b 57 8d fe c1 21 8b bf 87 0f b5 e0 a7 9f bb 6d 71 dd b0 63 2f .s.....N...kW...!.........mq..c/
02e0 f8 c2 97 67 1f 3b 37 64 59 46 26 9b 85 04 40 cb e5 36 8d 2e 65 6c 79 1b c9 eb 7a 45 55 97 cb 4e ...g.;7dYF&...@..6..ely...zEU..N
0300 78 9e 4e 4e 56 e5 29 c7 f8 f4 93 8f 71 f3 da 55 83 70 1c f2 a5 2e 53 c8 e7 37 ab 8b e7 a9 de 5f x.NNV.).....q..U.p....S..7....._
0320 e9 75 44 63 ed 55 03 cb da f1 72 69 a9 6a e0 dd b0 e3 df f6 85 f7 f9 7c 88 84 c3 50 14 85 66 a0 .uDc.U....ri.j.........|...P..f.
0340 28 8a 54 e1 cd 03 07 e8 6b 45 55 a9 8e a2 28 00 d3 9a 42 a2 68 99 3d a2 28 c2 ef df 6a df 6e f0 (.T.....kEU...(...B.h.=.(...j.n.
0360 d8 61 48 2b 49 48 2b 49 4b 87 b2 c3 98 9e 9d 45 34 d6 6e 1b 04 7f 20 40 2b c5 b4 43 55 55 c7 c0 .aH+IH+IK......E4.n....@+..CUU..
0380 ba 61 c7 5e f0 85 d7 34 8d b6 58 b3 ca d6 d6 d6 a8 02 c7 71 f0 78 bd 74 0e b3 ad d8 e7 dd aa 6e .a.^...4..X........q.x.t.......n
03a0 2d 97 43 71 63 c3 82 91 5a 4b 6d 7d ef 02 8f 5b b6 96 8b b9 35 b3 18 eb eb eb 8e fa ff 15 5f 78 -.Cqc...ZKm}...[....5........._x
03c0 94 32 ca 5c e8 08 c7 59 b6 fb f2 e5 2b ab 69 c8 6a 9a e5 c8 c1 0a 8b 91 62 9c 71 85 c7 06 23 3e .2.\...Y....+.i.j.......b.q...#>
03e0 3e 81 70 53 23 f2 ba 0e 6f d9 65 46 9e 39 69 ac a6 52 8e 01 0b 06 83 d8 bf 7f bf ad 1d b6 e2 82 >.pS#...o.eF.9i..R..............
0400 1d 7d fd fd 98 99 9d a3 15 cd 2e 78 2c 46 cb db cd 20 84 db 36 ee b5 f8 c2 1b c5 22 cd be 7c 69 .}.........x,F......6......"..|i
0420 be 08 21 11 05 bd 40 7f 2c 8a 22 ba 1f f4 e0 a3 0f 3f 80 28 8a f4 52 81 9d 25 e5 18 3e bf df e2 ..!...@.,."......?.(..R..%..>...
0440 f4 4e 79 4c b1 e3 b1 c3 68 68 a8 c7 e3 91 27 3b 5e 92 ec 24 5f 28 58 82 25 8a 22 7c 3e bf f3 b3 .NyL....hh....';^..$_(X.%."|>...
0460 77 c1 8e 6f be ed dc 91 ee dd ae db c6 c8 93 51 c7 b8 ef c6 17 5e d7 75 84 ea eb e9 9c 00 80 b1 w..o...........Q.....^.u........
0480 78 1c ef 1e 3b 46 af 05 ef dd bf 8f d8 17 51 3c ec 7d 44 37 54 29 91 a0 8e 0f f4 74 1b ef 1c 3b x...;F........Q<.}D7T).....t...;
04a0 8a 89 c9 29 b0 17 35 9f 9f 38 8e 2f af 5c 31 ce b4 b5 91 9d f0 98 17 10 00 6c 79 ec 30 5a df 6b ...)..5..8./.\1..........ly.0Z.k
04c0 c5 8f df 7f 67 68 7a be 54 15 b2 65 a3 36 2b 69 35 b5 8a d8 b9 0e c7 ed bd a5 b9 19 4a 69 36 4a ....ghz.T..e.6+i5...........Ji6J
04e0 89 44 d5 ea 72 c3 8e 81 9e 6e 43 4a ae 56 8c 93 7a 31 04 16 e3 f0 e1 43 90 12 09 db 78 ec d6 17 .D..r....nCJ.V..z1.....C....x...
0500 de eb f3 41 96 65 10 42 20 08 02 9d 29 5f 7d 7d 8d 9c 3e 75 d2 18 18 7a 8c c5 c5 17 e4 d6 8d eb ...A.e.B....)_}}..>u...z........
0520 86 69 80 f9 70 4c a7 16 16 5f a0 7f 70 c8 82 21 08 02 e6 9f 2f 60 2c 1e c7 99 b6 36 6c c7 43 08 .i..pL..._..p..!..../`,....6l.C.
0540 a1 0b 90 a5 8d 31 3c 76 18 d2 b2 04 69 59 a2 8b 93 59 21 e5 f2 6c 7a 1a b1 73 1d 8e 0b 9c a2 aa .....1<v....iY...Y!..lz..s......
0560 14 23 12 0e 57 ad 2e 37 ec b0 8b 19 5b 38 26 c6 e8 e8 af 70 8a fb 6e 7d e1 7d 7e 3f 08 21 50 33 .#..W..7....[8&....p..n}.}~?.!P3
0580 19 7a f4 d0 f2 5a a9 35 dd 26 ec 1c 3a 10 89 d0 ed d3 42 68 83 c1 1a ec a4 c3 f2 9c 38 fe 99 61 .z...Z.5.&..:.....Bh........8..a
05a0 56 7e 4b 73 73 4d 3c 99 6c 96 2e 4f 4e 18 4e 0b 9c f9 a0 4c 8c 6a d5 e5 86 1d 7b c1 17 5e d3 34 V~KssM<.l..ON.N....L.j....{..^.4
05c0 08 82 00 41 10 b6 8e 1d cc 42 c3 b6 93 65 49 82 9a c9 54 2c 12 76 18 66 e6 56 d3 61 79 3a bb ee ...A.....B...eI...T,.v.f.V.ay:..
05e0 90 d3 a7 4e 1a 1c c7 d5 c4 a3 28 8a 25 78 4e 18 4e 0b 9c 89 69 62 98 f7 0c 4e 01 de ad 1d 7b c1 ...N......(.%xN.N...ib...N....{.
0600 17 fe c1 83 1e 4c 97 fe 42 35 db 49 a2 74 d6 64 a5 a7 b7 17 cf 9e 4d 5b f4 5e 2e 2f 03 00 ec 30 .....L..B5.I.t.d......M[.^./...0
0620 e8 df b6 c9 a4 a3 4e 39 8f d9 01 6a e1 31 ef 02 ca b3 bc 1c c3 4e fa 06 06 30 33 3b 67 c1 a8 76 ......N9...j.1.......N...03;g..v
0640 3a 70 c3 8e bd e0 cb df 2c 64 60 dc d8 2f f2 47 00 00 00 00 49 45 4e 44 ae 42 60 82 :p......,d`../.G....IEND.B`.
/a> 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
/*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "content_sao.h"
#include "collision.h"
#include "environment.h"

core::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;

/*
	TestSAO
*/

// Prototype
TestSAO proto_TestSAO(NULL, 0, v3f(0,0,0));

TestSAO::TestSAO(ServerEnvironment *env, u16 id, v3f pos):
	ServerActiveObject(env, id, pos),
	m_timer1(0),
	m_age(0)
{
	ServerActiveObject::registerType(getType(), create);
}

ServerActiveObject* TestSAO::create(ServerEnvironment *env, u16 id, v3f pos,
		const std::string &data)
{
	return new TestSAO(env, id, pos);
}

void TestSAO::step(float dtime, bool send_recommended)
{
	m_age += dtime;
	if(m_age > 10)
	{
		m_removed = true;
		return;
	}

	m_base_position.Y += dtime * BS * 2;
	if(m_base_position.Y > 8*BS)
		m_base_position.Y = 2*BS;

	if(send_recommended == false)
		return;

	m_timer1 -= dtime;
	if(m_timer1 < 0.0)
	{
		m_timer1 += 0.125;
		//dstream<<"TestSAO: id="<<getId()<<" sending data"<<std::endl;

		std::string data;

		data += itos(0); // 0 = position
		data += " ";
		data += itos(m_base_position.X);
		data += " ";
		data += itos(m_base_position.Y);
		data += " ";
		data += itos(m_base_position.Z);

		ActiveObjectMessage aom(getId(), false, data);
		m_messages_out.push_back(aom);
	}
}


/*
	ItemSAO
*/

// Prototype
ItemSAO proto_ItemSAO(NULL, 0, v3f(0,0,0), "");

ItemSAO::ItemSAO(ServerEnvironment *env, u16 id, v3f pos,
		const std::string inventorystring):
	ServerActiveObject(env, id, pos),
	m_inventorystring(inventorystring),
	m_speed_f(0,0,0),
	m_last_sent_position(0,0,0)
{
	ServerActiveObject::registerType(getType(), create);
}

ServerActiveObject* ItemSAO::create(ServerEnvironment *env, u16 id, v3f pos,
		const std::string &data)
{
	std::istringstream is(data, std::ios::binary);
	char buf[1];
	// read version
	is.read(buf, 1);
	u8 version = buf[0];
	// check if version is supported
	if(version != 0)
		return NULL;
	std::string inventorystring = deSerializeString(is);
	dstream<<"ItemSAO::create(): Creating item \""
			<<inventorystring<<"\""<<std::endl;
	return new ItemSAO(env, id, pos, inventorystring);
}

void ItemSAO::step(float dtime, bool send_recommended)
{
	assert(m_env);

	const float interval = 0.2;
	if(m_move_interval.step(dtime, interval)==false)
		return;
	dtime = interval;
	
	core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
	collisionMoveResult moveresult;
	// Apply gravity
	m_speed_f += v3f(0, -dtime*9.81*BS, 0);
	// Maximum movement without glitches
	f32 pos_max_d = BS*0.25;
	// Limit speed
	if(m_speed_f.getLength()*dtime > pos_max_d)
		m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
	v3f pos_f = getBasePosition();
	v3f pos_f_old = pos_f;
	moveresult = collisionMoveSimple(&m_env->getMap(), pos_max_d,
			box, dtime, pos_f, m_speed_f);
	
	if(send_recommended == false)
		return;

	if(pos_f.getDistanceFrom(m_last_sent_position) > 0.05*BS)
	{
		setBasePosition(pos_f);
		m_last_sent_position = pos_f;

		std::ostringstream os(std::ios::binary);
		char buf[6];
		// command (0 = update position)
		buf[0] = 0;
		os.write(buf, 1);
		// pos
		writeS32((u8*)buf, m_base_position.X*1000);
		os.write(buf, 4);
		writeS32((u8*)buf, m_base_position.Y*1000);
		os.write(buf, 4);
		writeS32((u8*)buf, m_base_position.Z*1000);
		os.write(buf, 4);
		// create message and add to list
		ActiveObjectMessage aom(getId(), false, os.str());
		m_messages_out.push_back(aom);
	}
}

std::string ItemSAO::getClientInitializationData()
{
	std::ostringstream os(std::ios::binary);
	char buf[6];
	// version
	buf[0] = 0;
	os.write(buf, 1);
	// pos
	writeS32((u8*)buf, m_base_position.X*1000);
	os.write(buf, 4);
	writeS32((u8*)buf, m_base_position.Y*1000);
	os.write(buf, 4);
	writeS32((u8*)buf, m_base_position.Z*1000);
	os.write(buf, 4);
	// inventorystring
	os<<serializeString(m_inventorystring);
	return os.str();
}

std::string ItemSAO::getStaticData()
{
	dstream<<__FUNCTION_NAME<<std::endl;
	std::ostringstream os(std::ios::binary);
	char buf[1];
	// version
	buf[0] = 0;
	os.write(buf, 1);
	// inventorystring
	os<<serializeString(m_inventorystring);
	return os.str();
}

InventoryItem * ItemSAO::createInventoryItem()
{
	try{
		std::istringstream is(m_inventorystring, std::ios_base::binary);
		InventoryItem *item = InventoryItem::deSerialize(is);
		dstream<<__FUNCTION_NAME<<": m_inventorystring=\""
				<<m_inventorystring<<"\" -> item="<<item
				<<std::endl;
		return item;
	}
	catch(SerializationError &e)
	{
		dstream<<__FUNCTION_NAME<<": serialization error: "
				<<"m_inventorystring=\""<<m_inventorystring<<"\""<<std::endl;
		return NULL;
	}
}

void ItemSAO::rightClick(Player *player)
{
	dstream<<__FUNCTION_NAME<<std::endl;
	InventoryItem *item = createInventoryItem();
	if(item == NULL)
		return;
	
	bool to_be_deleted = item->use(m_env, player);

	if(to_be_deleted)
		m_removed = true;
}

/*
	RatSAO
*/

// Prototype
RatSAO proto_RatSAO(NULL, 0, v3f(0,0,0));

RatSAO::RatSAO(ServerEnvironment *env, u16 id, v3f pos):
	ServerActiveObject(env, id, pos),
	m_is_active(false),
	m_speed_f(0,0,0)
{
	ServerActiveObject::registerType(getType(), create);

	m_oldpos = v3f(0,0,0);
	m_last_sent_position = v3f(0,0,0);
	m_yaw = myrand_range(0,PI*2);
	m_counter1 = 0;
	m_counter2 = 0;
	m_age = 0;
	m_touching_ground = false;
}

ServerActiveObject* RatSAO::create(ServerEnvironment *env, u16 id, v3f pos,
		const std::string &data)
{
	std::istringstream is(data, std::ios::binary);
	char buf[1];
	// read version
	is.read(buf, 1);
	u8 version = buf[0];
	// check if version is supported
	if(version != 0)
		return NULL;