Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
K'van
Tales of MajEyal
Commits
8565ba29
Commit
8565ba29
authored
14 years ago
by
dg
Browse files
Options
Downloads
Patches
Plain Diff
fix
git-svn-id:
http://svn.net-core.org/repos/t-engine4@3114
51575b47-30f0-44d4-a5cc-537603b46e54
parent
12b611a5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
game/engines/default/engine/interface/ActorProject.lua
+1
-1
1 addition, 1 deletion
game/engines/default/engine/interface/ActorProject.lua
game/engines/default/engine/utils.lua
+8
-6
8 additions, 6 deletions
game/engines/default/engine/utils.lua
src/fov/fov.c
+5
-4
5 additions, 4 deletions
src/fov/fov.c
with
14 additions
and
11 deletions
game/engines/default/engine/interface/ActorProject.lua
+
1
−
1
View file @
8565ba29
...
...
@@ -315,7 +315,7 @@ function _M:projectDoStop(typ, tg, damtype, dam, particles, lx, ly, tmp, rx, ry)
game
.
level
.
map
.
w
,
game
.
level
.
map
.
h
,
typ
.
cone
,
initial_dir
,
dir_angle
,
typ
.
cone_angle
,
function
(
_
,
px
,
py
)
if
typ
.
block_radius
and
typ
:
block_radius
(
px
,
py
)
then
return
true
end
...
...
This diff is collapsed.
Click to expand it.
game/engines/default/engine/utils.lua
+
8
−
6
View file @
8565ba29
...
...
@@ -855,11 +855,12 @@ function core.fov.circle_grids(x, y, radius, block)
if
radius
==
0
then
return
{[
x
]
=
{[
y
]
=
true
}}
end
local
grids
=
{}
core
.
fov
.
calc_circle
(
x
,
y
,
game
.
level
.
map
.
w
,
game
.
level
.
map
.
h
,
radius
,
function
(
_
,
lx
,
ly
)
if
block
and
game
.
level
.
map
:
checkEntity
(
lx
,
ly
,
engine
.
Map
.
TERRAIN
,
"block_move"
)
then
return
true
end
end
,
function
()
if
not
grids
[
lx
]
then
grids
[
lx
]
=
{}
end
grids
[
lx
][
ly
]
=
true
if
block
and
game
.
level
.
map
:
checkEntity
(
lx
,
ly
,
engine
.
Map
.
TERRAIN
,
"block_move"
)
then
return
true
end
end
,
function
()
end
,
nil
)
end
,
nil
)
-- point of origin
if
not
grids
[
x
]
then
grids
[
x
]
=
{}
end
...
...
@@ -872,11 +873,12 @@ function core.fov.beam_grids(x, y, radius, dir, angle, block)
if
radius
==
0
then
return
{[
x
]
=
{[
y
]
=
true
}}
end
local
grids
=
{}
core
.
fov
.
calc_beam
(
x
,
y
,
game
.
level
.
map
.
w
,
game
.
level
.
map
.
h
,
radius
,
dir
,
angle
,
function
(
_
,
lx
,
ly
)
if
block
and
game
.
level
.
map
:
checkEntity
(
lx
,
ly
,
engine
.
Map
.
TERRAIN
,
"block_move"
)
then
return
true
end
end
,
function
()
if
not
grids
[
lx
]
then
grids
[
lx
]
=
{}
end
grids
[
lx
][
ly
]
=
true
if
block
and
game
.
level
.
map
:
checkEntity
(
lx
,
ly
,
engine
.
Map
.
TERRAIN
,
"block_move"
)
then
return
true
end
end
,
function
()
end
,
nil
)
end
,
nil
)
-- point of origin
if
not
grids
[
x
]
then
grids
[
x
]
=
{}
end
...
...
This diff is collapsed.
Click to expand it.
src/fov/fov.c
+
5
−
4
View file @
8565ba29
...
...
@@ -123,7 +123,7 @@ void fov_settings_set_apply_lighting_function(fov_settings_type *settings,
unsigned
*
result
=
(
unsigned
*
)
malloc
((
maxdist
+
2
)
*
sizeof
(
unsigned
));
if
(
result
)
{
for
(
i
=
0
;
i
<=
maxdist
;
++
i
)
{
result
[
i
]
=
(
unsigned
)
sqrtf
((
float
)(
maxdist
*
maxdist
-
i
*
i
));
result
[
i
]
=
(
unsigned
)
sqrtf
((
float
)(
maxdist
*
maxdist
+
maxdist
-
i
*
i
));
}
result
[
maxdist
+
1
]
=
0
;
}
...
...
@@ -217,7 +217,6 @@ static float fov_slope(float dx, float dy) {
dy1 = (int)(0.5f + ((float)dx)*end_slope); \
\
rx = data->source_##rx signx dx; \
ry = data->source_##ry signy dy0; \
\
if (!apply_diag && dy1 == dx) { \
/* We do diagonal lines on every second octant, so they don't get done twice. */
\
...
...
@@ -225,6 +224,7 @@ static float fov_slope(float dx, float dy) {
\
/* But, we still need to check if we can see past it if the slopes are similar */
\
if (dy1 < dy0) { \
ry = data->source_##ry signy dy0; \
if (settings->opaque(data->map, x, y)) { \
return; \
} \
...
...
@@ -234,11 +234,12 @@ static float fov_slope(float dx, float dy) {
\
/* we also need to check if the previous spot is blocked */
\
if (dy0 > 0) { \
ry
-
=
1;
\
ry =
data->source_##ry signy (dy0-1);
\
if (settings->opaque(data->map, x, y)) { \
prev_blocked = 1; \
} else { \
prev_blocked = 0; \
} \
ry += 1; \
} \
\
switch (settings->shape) { \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment