-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport VSS to PC version #650
base: master
Are you sure you want to change the base?
Conversation
int pitch; | ||
SDL_LockTexture(sdlTexture, NULL, &pixels, &pitch); | ||
blitRgba((uint32_t*)pixels, get_default_render_buffer(), get_2d_rgba_render_buffer(), get_2d_render_buffer()); | ||
sys_frameQuant(pixels, xgrScreenSizeX, xgrScreenSizeY, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понятно, может ли JS писать в буфер в этом случае. Для PC версии выглядит странным и избыточно.
{ | ||
const char* ininame = sys_fileOpenQuant(_ininame, /*XS::IN*/ 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Внутри делается duk_pop(ctx); что приводит к тому что итоговый указатель на строку может уже не существовать. Скорее всего надо копировать.
{ | ||
|
||
const char* name = sys_fileOpenQuant(_name, f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential undefined behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
папка /src/vss должна быть в /lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кроме того .clang-format должен быть консистентным с глобальным. Или просто быть убран.
@@ -17,6 +17,8 @@ | |||
#include <ctype.h> | |||
#include "iniparser.h" | |||
|
|||
extern const char* sys_fileOpenQuant(const char* file, unsigned flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо избегать использовать позднего связывания и extern
.
id = xtInitApplication(); | ||
|
||
if (!sys_readyQuant()) { | ||
xtDoneApplication(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это штатный выход или нет? Не кажется что тут может быть штатный выход.
|
||
void xtClearMessageQueue(void) | ||
{ | ||
sys_tickQuant(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему оно тут а не основном цикле? xtClearMessageQueue вызывается так же во время разных анимаций в меню и эскейве.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот файл разве не должен быть в data? А тут может быть example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
разве не должен быть этот файл в некой папке example?
.prop("rudder", rudder) | ||
.prop("tractionIncrement", traction_increment) | ||
.prop("tractionDecrement", traction_decrement) | ||
.prop("tractionMax", 255) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется тут мы должны некую переменную передавать либо иметь константу уже в самом vss.
@@ -2,6 +2,7 @@ include_directories( | |||
"${PROJECT_SOURCE_DIR}/lib/xtool" | |||
"${PROJECT_SOURCE_DIR}/lib/xgraph" | |||
"${PROJECT_SOURCE_DIR}/lib/xsound" | |||
"${PROJECT_SOURCE_DIR}/src/vss/duktape-2.7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот движок должен подключаться как зависимость и не быть частью проекта.
@@ -71,14 +72,24 @@ SET(vangers_SRCS | |||
${WINDOWS_RES} | |||
actint/layout.h) | |||
|
|||
SET(vss_SRCS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо отдельно сделать CMakeFile для vss и собирать отдельную .a библиотеку.
int x,y,offs = 0; | ||
for(y = 0; y < SizeY; y ++){ | ||
for(x = 0; x < SizeX; x ++){ | ||
if(!(p -> flags & INV_ITEM_NO_ACTIV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не верный отступ пробелами тут
int x,y,offs = 0; | ||
for(y = 0; y < SizeY; y ++){ | ||
for(x = 0; x < SizeX; x ++){ | ||
if(!(p -> flags & INV_ITEM_NO_ACTIV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лишний пробел
int x,y,offs = 0; | ||
for(y = 0; y < SizeY; y ++){ | ||
for(x = 0; x < SizeX; x ++){ | ||
if(!(p -> flags & INV_ITEM_NO_ACTIV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем мы отправляем указатель в js и как мы с ним там работаем?
@@ -1343,6 +1344,17 @@ void iScreenElement::redraw(int x,int y,int sc,int sm,int hide_mode) | |||
if(flags & EL_NO_SCALE && scale != 256) | |||
return; | |||
|
|||
auto result = vss::sys() | |||
.quant(vss::REDRAW_QUANT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем нужуен этот квант? Тем более это просто redraw функция а не квант.
.prop("elementType", type) | ||
.send(); | ||
|
||
if (result.isPreventDefault()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется не безопасно блокировать перерисовку из JS для элементов UI, какой был кейс?
if(x >= 0 && y >= 0 && x <= SizeX && y <= SizeY) | ||
if(x >= 0 && y >= 0 && x <= SizeX && y <= SizeY) { | ||
auto result = vss::sys() | ||
.quant(vss::CHECK_XY_QUANT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем это?
@@ -1878,6 +1900,16 @@ void iScreenObject::init(void) | |||
|
|||
void iScreenObject::redraw(int mode) | |||
{ | |||
auto result = vss::sys() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
похожий вопросс.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duktape не должен быть в репозитории.
#define VANGERS_QUANT_NAMES_H | ||
|
||
namespace vss { | ||
constexpr const char* READY_QUANT = "ready"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем constexpr тут?
return 1; | ||
}, | ||
1}, | ||
{"getLineT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем это тут?
return 1; | ||
}, | ||
1}, | ||
{"renderLine", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это зачем?
return 0; | ||
}, | ||
1}, | ||
{"getRgbaData", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
аналогично.
return 0; | ||
}, | ||
7}, | ||
{"toBase64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
разве в js мы нет уже готовой функции для этого?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы где то разве используем base64?
if (duk_get_prop_string(ctx, -1, name)) { | ||
value = duk_to_string(ctx, -1); | ||
} | ||
duk_pop(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
потенциальная проблемма
Probably github don't ignore line spacing by default, please use this option to see actual diff: