Field of view, discovered tiles, opaque fog of war rendering

This commit is contained in:
John McCardle 2023-03-10 19:39:44 -05:00
commit 99fa92f8ba
4 changed files with 90 additions and 6 deletions

View file

@ -91,6 +91,7 @@ static PyMethodDef mcrfpyMethods[] = {
{"turnNumber", McRFPy_API::_turnNumber, METH_VARARGS, ""},
{"createEntity", McRFPy_API::_createEntity, METH_VARARGS, ""},
//{"listEntities", McRFPy_API::_listEntities, METH_VARARGS, ""},
{"refreshFov", McRFPy_API::_refreshFov, METH_VARARGS, ""},
{NULL, NULL, 0, NULL}
};
@ -681,6 +682,12 @@ PyObject* McRFPy_API::_modGrid(PyObject* self, PyObject* args) {
grid->points[i].tile_overlay = PyLong_AsLong(PyObject_GetAttrString(gpointobj, "tile_overlay"));
grid->points[i].uisprite = PyLong_AsLong(PyObject_GetAttrString(gpointobj, "uisprite"));
}
// update grid pathfinding & visibility
grid->refreshTCODmap();
for (auto e : McRFPy_API::entities.getEntities("player")) {
grid->refreshTCODsight(e->cGrid->x, e->cGrid->y);
}
}
PyObject* entlist = PyObject_GetAttrString(o, "entities");
//std::cout << PyUnicode_AsUTF8(PyObject_Repr(entlist)) << std::endl;
@ -697,6 +704,14 @@ PyObject* McRFPy_API::_modGrid(PyObject* self, PyObject* args) {
return Py_None;
}
PyObject* McRFPy_API::_refreshFov(PyObject* self, PyObject* args) {
for (auto e : McRFPy_API::entities.getEntities("player")) {
e->cGrid->grid->refreshTCODsight(e->cGrid->x, e->cGrid->y);
}
Py_INCREF(Py_None);
return Py_None;
}
PyObject* _test_createAnimation(PyObject *self, PyObject *args) {
//LerpAnimation<T>::LerpAnimation(float _d, T _ev, T* _t, std::function<void()> _cb, std::function<void(T)> _w, bool _l)
std::string menu_key = "demobox1";