76
OpenXcom Extended / Re: OXCE (OpenXcom Extended) main thread
« on: January 24, 2024, 10:51:21 pm »
There is some programs that are designed to edit save files, would they be better for this task?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
- update: STR_BLASTER_BOMB
power: 10
blastRadius: 2
vaporColorSurface: 6
vaporDensitySurface: 10
vaporProbabilitySurface: 100
scripts:
vaporParticleAmmo: |
var int temp;
set subvoxel_velocity subvoxel_trajectory_forward;
muldiv subvoxel_velocity -3 2;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addX temp;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addY temp;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addZ temp;
begin;
var int last 6000;
sub last subvoxel_trajectory_distance_max;
add last subvoxel_trajectory_distance;
if gt last 0;
set temp 100;
muldiv temp last 6000;
random.randomChance temp;
if gt temp 0;
muldiv subvoxel_velocity last 6000;
end;
else lt subvoxel_trajectory_distance 6000;
muldiv subvoxel_velocity subvoxel_trajectory_distance 6000;
end;
end;
subvoxel_velocity.addZ 200;
return;
- update: STR_LASER_RIFLE
vaporColorSurface: 5
vaporDensitySurface: 1
vaporProbabilitySurface: 100
scripts:
vaporParticleAmmo: |
# noting
return;
- update: STR_RIFLE_CLIP
vaporColorSurface: 2
vaporDensitySurface: 17
vaporProbabilitySurface: 100
scripts:
vaporParticleAmmo: |
var int off;
var int temp;
if lt particle_number 3;
var Position up subvoxel_trajectory_up;
var Position right subvoxel_trajectory_right;
var int sin;
var int cos;
set sin subvoxel_trajectory_distance;
set cos subvoxel_trajectory_distance;
wavegen_sin sin 10000 8;
wavegen_cos cos 10000 8;
mul up sin;
mul right cos;
set subvoxel_offset up;
add subvoxel_offset right;
set subvoxel_velocity 0 0 0;
set subvoxel_acceleration 0 0 0;
set subvoxel_drift 10;
set subvoxel_velocity subvoxel_trajectory_forward;
mul subvoxel_velocity -1;
else lt particle_number 5;
add vapor_color -2;
set subvoxel_drift 50;
set subvoxel_velocity subvoxel_trajectory_forward;
else lt particle_number 12;
# set off subvoxel_trajectory_distance;
# wavegen_sin off 1200 5;
set vapor_color -1;
# add vapor_color +1;
# set subvoxel_velocity 0 0 150;
# set subvoxel_acceleration 0 0 off;
else;
var int sin;
var int last 6400;
sub last subvoxel_trajectory_distance_max;
add last subvoxel_trajectory_distance;
if gt last 0;
#hit point
add vapor_color -2;
set subvoxel_offset subvoxel_trajectory_forward;
muldiv subvoxel_offset last 256;
random.randomRangeSymmetric temp 500;
subvoxel_velocity.setX temp;
random.randomRangeSymmetric temp 500;
subvoxel_velocity.setY temp;
random.randomRangeSymmetric temp 500;
subvoxel_velocity.setZ temp;
set subvoxel_acceleration subvoxel_velocity;
muldiv subvoxel_acceleration -1 50;
else lt subvoxel_trajectory_distance 6000;
add vapor_color +1;
#start trajectory
set subvoxel_velocity subvoxel_trajectory_forward;
mul subvoxel_velocity -4;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addX temp;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addY temp;
random.randomRangeSymmetric temp 100;
subvoxel_velocity.addZ temp;
set subvoxel_acceleration 0 0 -10;
else;
# set sin subvoxel_trajectory_distance;
# wavegen_sin sin 1000 -12;
# add vapor_color -1;
# set subvoxel_acceleration 0 0 sin;
# set subvoxel_drift 1000;
# set vapor_color -1;
end;
end;
return;
In next week I prepare more concrete examples of some popular weapons trails.
It then gets into this part of C++ I have difficulty understanding. With the Lambdas. For reasons I don't understand I can hover over some of the parameters to see their values but not all of them.I meet problems like this when compiler optimalize out variable I like to look on. some times `volatile` to keep compiler hands away from it.
The _battleGame that is being deleted in SavedGame::setBattleGame looks like a valid object. It has members like _missionType = "STR_TERROR_MISSION", which is what the mission is. And the parameter when it's called from DebriefingState::init() is just a null-pointer. So it tries to delete the current valid _battleGame-object and then set the _battleGame-pointer to nullptr.And how this could affect anything? do `PandfindingNode` try delete `_prevNode`? No, it could even work without any destructor.
The issue really seems to be deleting the _nodes and _altNodes-vectors. (std::vector<PathfindingNode> _nodes, _altNodes;)
According to ChatGPT it could be problematic that the PathfindingNode-object has a pointer to another PandfindingNode via PathfindingNode* _prevNode;
"The PathfindingNode class seems to contain pointers (PathfindingNode* _prevNode) that reference other PathfindingNode instances, forming a linked structure. When you're using std::vector to manage a collection of PathfindingNode instances and they contain interconnections via pointers (_prevNode), deleting these nodes within a std::vector can potentially lead to issues.
If nodes are connected in a complex manner (such as forming a linked list or a graph), deleting them within a std::vector could break those connections and cause issues when pointers are no longer valid after deletion."
void SavedGame::setBattleGame(SavedBattleGame *battleGame)
{
delete _battleGame;
_battleGame = battleGame;
}