Skip to content

Commit

Permalink
feat: data/setup.otml
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah authored May 14, 2023
1 parent 4d43431 commit a8329ef
Show file tree
Hide file tree
Showing 50 changed files with 917 additions and 549 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### Based on [edubart/otclient](https://github.com/edubart/otclient) Rev: [2.760](https://github.com/edubart/otclient/commit/fc39ee4adba8e780a2820bfda66fc942d74cedf4)

#### [Note: for those who are with the walking system stuttering...](https://github.com/mehah/otclient/blob/main/modules/client_config/config.lua#L5)
#### [Note: for those who are with the walking system stuttering...](https://github.com/mehah/otclient/blob/main/data/setup.otml#L18)

### Features

Expand All @@ -28,7 +28,6 @@
- Support for more mouse buttons, for example 4 and 5
- Module Controller System ([Code example](https://github.com/mehah/otclient/blob/cache-for-all/modules/game_minimap/minimap.lua))
- Some bugs fixed contained in [edubart/otclient](https://github.com/edubart/otclient)
- Client Config in [config.h](https://github.com/mehah/otclient/blob/cache-for-all/src/client/config.h)
- Client 12.85 ~ 12.92, 13.00 ~ 13.14 support (protobuf)
- Market has been rewritten to work only [Canary](https://github.com/opentibiabr/canary)
- Async Texture Loading
Expand Down
36 changes: 36 additions & 0 deletions data/setup.otml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
game
sprite-size: 32
last-supported-version: 1291

map
viewport: 8 6
max-z: 15
sea-floor: 7
underground-floor: 8
aware-underground-floor-range: 2

tile
max-elevation: 24
max-things: 10
transparent-floor-view-range: 2

creature
force-new-walking-formula: true
shield-blink-ticks: 500
volatile-square-duration: 1000
adjust-creature-information-based-crop-size: false

render
invisible-ticks-per-frame: 500
item-ticks-per-frame: 500
effect-ticks-per-frame: 75
missile-ticks-per-frame: 75
animated-text-duration: 1000
static-duration-per-character: 60
min-static-text-duration: 3000

font
widget: verdana-11px-antialised
static-text: verdana-11px-rounded
animated-text: verdana-11px-rounded
creature-text: verdana-11px-rounded
1 change: 0 additions & 1 deletion modules/client/client.otmod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Module
load-later:
- client_styles
- client_locales
- client_config
- client_topmenu
- client_background
- client_options
Expand Down
14 changes: 0 additions & 14 deletions modules/client_config/config.lua

This file was deleted.

8 changes: 0 additions & 8 deletions modules/client_config/config.otmod

This file was deleted.

11 changes: 6 additions & 5 deletions modules/client_styles/styles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ local resourceLoaders = {
function init()
local device = g_platform.getDevice()
importResources("styles", "otui", device)
importResources("fonts", "otfont", device)
importResources("fonts", "otfont", device)
importResources("particles", "otps", device)

g_mouse.loadCursors('/cursors/cursors')
g_gameConfig.loadFonts()
end

function terminate()
end

function importResources(dir, type, device)
local path = '/'..dir..'/'
local path = '/' .. dir .. '/'
local files = g_resources.listDirectoryFiles(path)
for _,file in pairs(files) do
for _, file in pairs(files) do
if g_resources.isFileType(file, type) then
resourceLoaders[type](path .. file)
end
Expand All @@ -29,11 +30,11 @@ function importResources(dir, type, device)
if device then
local devicePath = g_platform.getDeviceShortName(device.type)
if devicePath ~= "" then
table.insertall(files, importResources(dir..'/'..devicePath, type))
table.insertall(files, importResources(dir .. '/' .. devicePath, type))
end
local osPath = g_platform.getOsShortName(device.os)
if osPath ~= "" then
table.insertall(files, importResources(dir..'/'..osPath, type))
table.insertall(files, importResources(dir .. '/' .. osPath, type))
end
return
end
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ set(SOURCE_FILES
client/creatures.cpp
client/effect.cpp
client/game.cpp
client/gameconfig.cpp
client/houses.cpp
client/item.cpp
client/itemtype.cpp
Expand All @@ -250,6 +251,7 @@ set(SOURCE_FILES
client/missile.cpp
client/outfit.cpp
client/player.cpp
client/position.cpp
client/protocolcodes.cpp
client/protocolgame.cpp
client/protocolgameparse.cpp
Expand Down
13 changes: 7 additions & 6 deletions src/client/animatedtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
#include <framework/core/graphicalapplication.h>
#include "game.h"
#include "map.h"
#include "gameconfig.h"

AnimatedText::AnimatedText()
{
m_cachedText.setFont(g_fonts.getAnimatedTextFont());
m_cachedText.setFont(g_gameConfig.getAnimatedTextFont());
m_cachedText.setAlign(Fw::AlignLeft);
}

void AnimatedText::drawText(const Point& dest, const Rect& visibleRect)
{
constexpr static float tf = ANIMATED_TEXT_DURATION,
tftf = ANIMATED_TEXT_DURATION * ANIMATED_TEXT_DURATION;
const float tf = g_gameConfig.getAnimatedTextDuration(),
tftf = g_gameConfig.getAnimatedTextDuration() * g_gameConfig.getAnimatedTextDuration();

const auto& textSize = m_cachedText.getTextSize();
const float t = m_animationTimer.ticksElapsed();
Expand All @@ -55,7 +56,7 @@ void AnimatedText::drawText(const Point& dest, const Rect& visibleRect)
p.scale(g_app.getAnimatedTextScale());

const Rect& rect{ p, textSize };
constexpr float t0 = tf / 1.2;
const float t0 = tf / 1.2;

Color color = m_color;
if (t > t0) {
Expand All @@ -69,7 +70,7 @@ void AnimatedText::onAppear()
{
m_animationTimer.restart();

uint16_t textDuration = ANIMATED_TEXT_DURATION;
uint16_t textDuration = g_gameConfig.getAnimatedTextDuration();
if (g_app.mustOptimize())
textDuration /= 2;

Expand All @@ -85,7 +86,7 @@ bool AnimatedText::merge(const AnimatedTextPtr& other)
if (other->getCachedText().getFont() != m_cachedText.getFont())
return false;

if (m_animationTimer.ticksElapsed() > ANIMATED_TEXT_DURATION / 2.5)
if (m_animationTimer.ticksElapsed() > g_gameConfig.getAnimatedTextDuration() / 2.5)
return false;

try {
Expand Down
3 changes: 2 additions & 1 deletion src/client/attachedeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "attachedeffect.h"
#include "shadermanager.h"
#include "gameconfig.h"
#include <framework/core/clock.h>
#include <framework/graphics/animatedtexture.h>

Expand Down Expand Up @@ -86,7 +87,7 @@ int AttachedEffect::getCurrentAnimationPhase()

if (m_thingType->isEffect()) {
const int lastPhase = m_thingType->getAnimationPhases() - 1;
const int phase = std::min<int>(static_cast<int>(m_animationTimer.ticksElapsed() / (EFFECT_TICKS_PER_FRAME / getSpeed())), lastPhase);
const int phase = std::min<int>(static_cast<int>(m_animationTimer.ticksElapsed() / (g_gameConfig.getEffectTicksPerFrame() / getSpeed())), lastPhase);
if (phase == lastPhase) m_animationTimer.restart();
return phase;
}
Expand Down
2 changes: 2 additions & 0 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void Client::init(std::vector<std::string>& /*args*/)
// register needed lua functions
registerLuaFunctions();

g_gameConfig.init();
g_map.init();
g_minimap.init();
g_game.init();
Expand All @@ -57,4 +58,5 @@ void Client::terminate()
g_sprites.terminate();
g_spriteAppearances.terminate();
g_shaders.terminate();
g_gameConfig.terminate();
}
28 changes: 0 additions & 28 deletions src/client/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#pragma once

// GENERAL
#define SPRITE_SIZE 32
#define ASYNC_DISPATCHER_MAX_THREAD 6

// APPEARANCES
Expand All @@ -32,33 +31,6 @@
#define LZMA_HEADER_SIZE LZMA_PROPS_SIZE + 8
#define SPRITE_SHEET_WIDTH_BYTES 384 * 4

// TILE
#define MAX_ELEVATION 24
#define MAX_THINGS 10
#define TRANSPARENT_FLOOR_VIEW_RANGE 2

// CREATURE
#define SHIELD_BLINK_TICKS 500
#define VOLATILE_SQUARE_DURATION 1000
#define ADJUST_CREATURE_INFORMATION_BASED_ON_CROP_SIZE 0 // 1 to enable

// FLOOR
#define SEA_FLOOR 7
#define MAX_Z 15
#define UNDERGROUND_FLOOR SEA_FLOOR + 1
#define AWARE_UNDEGROUND_FLOOR_RANGE 2

// TICKS
#define INVISIBLE_TICKS_PER_FRAME 500
#define ITEM_TICKS_PER_FRAME 500
#define EFFECT_TICKS_PER_FRAME 75
#define MISSILE_TICKS_PER_FRAME 75

// TEXT
#define ANIMATED_TEXT_DURATION 1000
#define STATIC_DURATION_PER_CHARACTER 60
#define MIN_STATIC_TEXT_DURATION 3000

// ENCRYPTION SYSTEM
// Enable client encryption
#define ENABLE_ENCRYPTION 0
Expand Down
Loading

0 comments on commit a8329ef

Please sign in to comment.