From 1ef950671d2904f6037a767ea18f4a79d8ffbc15 Mon Sep 17 00:00:00 2001 From: "Ben Russell (300178622)" Date: Thu, 10 Jan 2013 13:46:23 +1300 Subject: [PATCH] [0.0-10] fixed some renderer quirks i.e. TICKED TWO BOXES ON THE TODO, HELL YES - also added (but not implemented yet) Dany0's czech translation --- CREDITS.txt | 3 +++ README.txt | 3 +-- docs/00README.txt | 2 +- include/common.h | 2 +- msrc/main/credits.py | 6 +++++ pkg/base/lang_en.lua | 18 +++++++++++++ src/render.c | 64 +++++++++++++++++++++++++++++++++++--------- 7 files changed, 82 insertions(+), 16 deletions(-) diff --git a/CREDITS.txt b/CREDITS.txt index 70e84cd..aae96c4 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -16,6 +16,9 @@ BR: "Are you sure?" on quit Improved key binding system +Dany0: + Czech translation + Ericson2314: Rearranged the build tree Added an SSE-optimised matrix-vector multiply diff --git a/README.txt b/README.txt index 9fcdb1b..0b425ff 100644 --- a/README.txt +++ b/README.txt @@ -47,5 +47,4 @@ STUFF TO DO BEFORE 0.1 CAN BE RELEASED: - make net_pack more solid - JSON writer - make kicking not suck -- correct render order for upper blocks -- draw the ceiling +- face-dependent shading diff --git a/docs/00README.txt b/docs/00README.txt index 4e45c15..60e73f3 100644 --- a/docs/00README.txt +++ b/docs/00README.txt @@ -1,4 +1,4 @@ -This section is obsolete. +This section is obsolete (mostly, some stuff is still updated here). The documentation here is most likely out of date. Read the HTML manual in MANUAL/. diff --git a/include/common.h b/include/common.h index 8a810e2..84cd0a8 100644 --- a/include/common.h +++ b/include/common.h @@ -19,7 +19,7 @@ #define VERSION_X 0 #define VERSION_Y 0 #define VERSION_A 0 -#define VERSION_Z 9 +#define VERSION_Z 10 // Remember to bump "Z" basically every time you change the engine! // Remember to bump the version in Lua too! // Z can only be 0 for official releases! diff --git a/msrc/main/credits.py b/msrc/main/credits.py index 5800a7e..0a5a726 100644 --- a/msrc/main/credits.py +++ b/msrc/main/credits.py @@ -25,6 +25,12 @@ SECTIONS = [ ]) ]), + ("Dany0", None, [ + ("Beginning contributor", None, [ + ("Czech translation", None, None), + ]) + ]), + ("Ericson2314 / SonarPulse", None, [ ("Engine programmer", None, [ ("Rearranged the build tree", None, None), diff --git a/pkg/base/lang_en.lua b/pkg/base/lang_en.lua index dbddd2c..b930a9a 100644 --- a/pkg/base/lang_en.lua +++ b/pkg/base/lang_en.lua @@ -15,6 +15,8 @@ along with Ice Lua Components. If not, see . ]] +-- TODO: organise this into the correct files + lang_en = { ["join"] = function (p,t) return "* "..p.." has joined the "..t.." team" end ["quit"] = function (p) return "* "..p.." disconnected" end @@ -25,3 +27,19 @@ lang_en = { ["diefall"] = function (p) return ""..p.." fell too far" end ["tkill"] = function (ps,pd,w) return ""..ps.." teamkilled "..pd.." ("..w..")" end } + +lang_cz = { + ["join"] = function (p,t) return "* "..p.." se připojil do týmu "..t end + ["quit"] = function (p) return "* "..p.." se odpojil" end + ["chteam"] = function (p) return "* "..p.." změnil tým" end + ["chwpn"] = function (p) return "* "..p.." změnil zbraň" end + ["chat"] = function (p,m) return "<"..p.."> "..m end + ["kill"] = function (ps,pd,w) return ""..ps.." zabil "..pd.." ("..w..")" end + ["diefall"] = function (p) return ""..p.." udělal takovou tu věc alá lumíci" end + ["tkill"] = function (ps,pd,w) return ""..ps.." zabil spoluhráče "..pd.." ("..w..")" end +} + +lang_list = { + ["en"] = lang_en, + ["en"] = lang_cz, +} diff --git a/src/render.c b/src/render.c index 5e94a86..627a7a1 100644 --- a/src/render.c +++ b/src/render.c @@ -836,6 +836,8 @@ void render_vxl_redraw(camera_t *camera, map_t *map) float by = blky + suby; float bz = blkz + subz; + int byi = blky; + // check if we need to reallocate the mark table and block list { int markbase = xlen * zlen; @@ -880,6 +882,10 @@ void render_vxl_redraw(camera_t *camera, map_t *map) { raydata_t *rd = &(rayc_data[rayc_data_head++]); + // back this up so we can flip the top + rayblock_t *b_pstart = &(rayc_block[rayc_block_len]); + rayblock_t *b_pmid = b_pstart; + // get delta float dx = rd->x - bx; float dz = rd->z - bz; @@ -959,24 +965,45 @@ void render_vxl_redraw(camera_t *camera, map_t *map) b->y = iy2; b->color = 0xFF0000FF; } + b_pstart += 2; + b_pmid += 2; #endif // add the top blocks (if they exist and we can see them) if(lastn == 0) { if(y1 > 0.0f) y1 = 0; y2 = p[1]; - } else if(p[3] >= rd->y1-1) { + } else if(rayc_data_head == 1) { y1 = p[3]; y2 = p[1]; - uint32_t *c = (uint32_t *)(&p[-4]); + // just the immediate ceiling, thanks. #ifndef DEBUG_HIDE_MAIN - for(i = p[3]-1; i >= p[3]-topcount && i >= iy1; i--) { + rayblock_t *b = &rayc_block[rayc_block_len++]; + b->x = rd->x; + b->z = rd->z; + b->y = p[3]-1; + b->color = *(uint32_t *)(&p[-4]); + } +#endif + } else if(p[3] >= rd->y1-1) { + y1 = p[3]; + y2 = p[1]; + uint32_t *c = (uint32_t *)(&p[-4*topcount]); +#ifndef DEBUG_HIDE_MAIN + for(i = p[3]-topcount; i <= p[3]-1; i++) + { + if(i < iy1) + { + c++; + continue; + } + rayblock_t *b = &rayc_block[rayc_block_len++]; b->x = rd->x; b->z = rd->z; b->y = i; - b->color = *(c--); + b->color = *(c++); } #endif } @@ -1010,24 +1037,37 @@ void render_vxl_redraw(camera_t *camera, map_t *map) if(p[1] != p[3] && rd->y2 >= p[3]) y2 = p[1]; - c = (uint32_t *)(&p[-4]); + c = (uint32_t *)(&p[-4*topcount]); #ifndef DEBUG_HIDE_MAIN - for(i = p[3]-1; i >= p[3]-topcount; i--) + for(i = p[3]-topcount; i <= p[3]-1 && i <= iy2; i++) { - if(i > iy2) - { - c--; - continue; - } rayblock_t *b = &rayc_block[rayc_block_len++]; b->x = rd->x; b->z = rd->z; b->y = i; - b->color = *(c--); + b->color = *(c++); } #endif } + // find the y middle + while(b_pmid < &rayc_block[rayc_block_len] && b_pmid->y < byi) + b_pmid++; + b_pmid--; + + // flip! + while(b_pstart < b_pmid) + { + rayblock_t t; + + t = *b_pstart; + *b_pstart = *b_pmid; + *b_pmid = t; + + b_pstart++; + b_pmid--; + } + // correct the y spread if(y1 < by1) y1 = by1;