Commit Graph

2632 Commits

Author SHA1 Message Date
Konrad Kuśnierz 7ea6c46b2c Add binary operations for lua
This is something I was always missing - posibbility to operate on
binary files or streams in pure lua. In most cases we do only need to
read simple variables from files such as integers with different amount
of bytes. This "class" will provide that ability.

It's a simple implementation of following C module for lua:
http://www.inf.puc-rio.br/~roberto/struct/

It has much less, though. Following elements have been implemented:

">" flag to set mode to big endian.
"<" flag to set mode to little endian.
"b" a signed char.
"B" an unsigned char.
"h" a signed short (2 bytes).
"H" an unsigned short (2 bytes).
"i" a signed int (4 bytes).
"I" an unsigned int (4 bytes).
"l" a signed long (8 bytes).
"L" an unsigned long (8 bytes).
"s" a zero-terminated string.

An example how to use it:

```lua
local packed = Struct.pack('<LIhBsb', 123456789123456789, 123456789,
-3200, 255, 'Test message', -1)
-- packed is now a lua string we can save to file as binary data
local L, I, h, B, s, b = Struct.unpack('<LIhBsb', packed)
print(L, I, h, B, s, b)
```

You can use g_resources.readFileContents as function to read binary
files and parse them via this class.
2015-05-18 21:38:05 +02:00
Konrad Kuśnierz 0597ded1d3 Merge pull request #648 from Shawak/Shawak-b_vc12
fix visual studio include paths
2015-05-13 06:32:47 -05:00
Konrad Kuśnierz c3c2ac80e7 Fix drawing creatures in UICreature
I will leave this ugly hack for the time being, but I do encourage to change it later on. The whole "resize" boolean makes no sense since the outfit is resized by the destination rectangle anyway. I believe we should give it a try with a real size of the object defined in dat by the user for creatures bigger than 32x32.

Please keep in mind that we did cut bigger creatures to 48x48 (2*Otc::TILE_PIXELS*0.75f) before as well, so nothing really changed besides ability to properly draw bigger creatures than 64x64 on battlelist.
2015-05-12 23:44:10 +02:00
Konrad Kuśnierz 6bd0e37670 Correctly draw creatures bigger than 64x64
Battlelist icon
2015-05-12 10:16:14 +02:00
Konrad Kuśnierz 11990815a6 Correctly load corrupted otmm file, should fix #606 2015-05-10 22:31:10 +02:00
Konrad Kuśnierz ded8fef16b Change bitter badge and made it inline with travis 2015-05-10 22:25:46 +02:00
Konrad Kuśnierz 53dbbd2ba3 Decrease RAM usage by at least 200MB
This was quite ridiculous.

TILESTATE_LAST = 1 << 24

Basically we were creating 2^24 Color structures within the array, each
of them has 4 floats (16 bytes) resulting in about 256 MB of extra
wasted memory.
2015-05-09 20:27:04 +02:00
Eduardo Bart e4cdb3834b Merge pull request #661 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
2015-05-08 11:28:17 -03:00
The Gitter Badger 86dd7958e1 Added Gitter badge 2015-05-07 21:42:02 +00:00
TheSumm fe98efdc21 Fix modal dialog auto sizing, fixes #556 2015-04-20 19:22:50 +02:00
TheSumm 8e5bbcd3a1 Add tab-spacing tag to MoveableTabBars 2015-04-20 03:32:32 +02:00
TheSumm f936ab9aab fix #638 2015-04-19 13:59:45 +02:00
TheSumm 84f6cdec86 Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
TheSumm ab5bed456b Fix warning 2015-04-19 13:54:55 +02:00
Łukasz Kurowski 01c107ba62 Market my offers 2015-04-07 01:24:39 +02:00
Łukasz Kurowski ff0947c270 NPC start talk 2015-03-31 10:37:49 +02:00
Shawak a3e6cc54b5 fix visual studio include paths 2015-03-22 20:11:41 +01:00
TheSumm fcd481ee15 Added missing message mode 2015-03-09 23:26:39 +01:00
TheSumm b237b713ef Fix 10.76 login protocol, added missing lua consts 2015-03-09 16:46:26 +01:00
TheSumm 3bffa6b04a Terminal new line (Shift+Enter) functionality 2015-03-07 16:32:45 +01:00
TheSumm 83dc129f03 Protocol 10.76, fixed death window & death packet 2015-03-07 06:10:10 +01:00
Konrad Kuśnierz ca60efd786 Merge pull request #645 from gpedro/master
Update copyright for 2015
2015-03-04 16:43:38 +01:00
Gabriel Pedro 04b516a1a0 Update copyright for 2015 2015-03-04 10:36:51 -04:00
Eduardo Bart 5387f8fe83 Merge pull request #632 from SuggestName/master
Minor change in statusLabel anchor for Ctrl + .
2015-02-23 11:49:05 -03:00
Suggest Name b5c7374890 Update textmessage.otui 2015-02-21 20:40:16 -02:00
TheSumm f51a160bde Remove unintentionally added files 2015-02-15 03:27:32 +01:00
TheSumm cbf70c1d63 Enable protocol 10.75 2015-02-15 03:25:43 +01:00
Henrique Santiago 28ff65be5a Merge pull request #640 from Mignari/master
Added support for enhanced animations for items.
2015-02-13 16:07:07 -02:00
Nailson 74af47f4d6 Added support for enhanced animations for items.
Thanks to @conde2, @BenDol
2015-02-13 08:19:45 -03:00
TheSumm 4c4e0b9d07 Fix error showing after relogging with containers being open 2015-02-12 14:48:56 +01:00
Mateusz Pawlica af0819f454 Changed rule violation window default focus 2015-01-31 22:31:58 +01:00
Mateusz Pawlica 27f7871a08 Minimap widget is now horizontally resizeable 2015-01-31 22:30:14 +01:00
TheSumm 6961492e00 Fix console tabs not blinking, closes #627 2015-01-30 19:56:56 +01:00
TheSumm 1c3cfddab0 Removed tr() from UIHeader 2015-01-28 00:01:53 +01:00
TheSumm 71931b961a Full protocol 10.74 support (session key), entergame style fixes 2015-01-27 23:44:37 +01:00
TheSumm 64e9406488 Fixed 'widget destroyed but still have 1 reference left' related to console module 2015-01-27 21:14:38 +01:00
BenDol 900ebbd985 Fixes #181 and fixes #551 2015-01-27 22:11:52 +13:00
TheSumm cb7cea6809 Tiny signalcall fix 2015-01-25 21:20:48 +01:00
TheSumm 4e2ded571e Fixed not being able to relog after reloading gamelib 2015-01-25 14:17:16 +01:00
TheSumm da2762dac3 Market now highlights offers which differ from the average price 2015-01-25 13:41:00 +01:00
TheSumm eb3c244023 More Market fixes
* Fixed NextButton and PreviousButton style
* Little update to SpinBox including dontSignal
* Market cleanup and more check to be safe
* Limit Market amountWindow by player balance
* Set proper maximum amount when creating offers
* Fixed fee label not calculating the correct fee sometimes
2015-01-25 02:28:53 +01:00
TheSumm 3157e7924f Market updates, now using showAs / tradeAs so every items works properly, some cleanup / bug fixing 2015-01-23 02:52:05 +01:00
TheSumm 92e2e8224f Added market message, reworked text messages a little 2015-01-22 20:38:28 +01:00
TheSumm 1d022905ab Fix button style (closes #607) 2015-01-22 11:49:04 +01:00
TheSumm 607dab01d6 Added Market column sorting (fixes #429), updated UITable and fixed not working methods 2015-01-21 23:40:15 +01:00
TheSumm 6edc73a8ba Fix Enter Game window not being centered on startup 2015-01-21 18:58:30 +01:00
TheSumm 596717bf32 Added locale number formatting to locale files 2015-01-20 16:18:04 +01:00
TheSumm b5cea41f87 Market fixes
- Market now works after reloading
- Fixed button / tab styles
- MarketRightTabBarButton now inherits the base style
- Fixed amountWindow buttons being hardly clickable
- "All" search filter is now on by default
2015-01-20 14:34:45 +01:00
TheSumm 8542f8bfd4 Protocol 10.73 support 2015-01-20 11:07:38 +01:00
TheSumm fc76ca4523 Updated advernturer blessing inventory style to be more robust 2015-01-19 01:52:49 +01:00