| 13 | } |
| 14 | |
| 15 | void ParticleDebug::Debug(int mode, int x, int y) |
| 16 | { |
| 17 | int i = 0; |
| 18 | String logmessage; |
| 19 | |
| 20 | if (mode == 0) |
| 21 | { |
| 22 | if (!sim->NUM_PARTS) |
| 23 | return; |
| 24 | i = sim->debug_nextToUpdate; |
| 25 | while (i < NPART - 1 && !sim->parts[i].type) |
| 26 | i++; |
| 27 | if (i == NPART - 1) |
| 28 | logmessage = "End of particles reached, updated sim"; |
| 29 | else |
| 30 | logmessage = String::Build("Updated particle #", i); |
| 31 | } |
| 32 | else if (mode == 1) |
| 33 | { |
| 34 | i = NPART - 1; |
| 35 | if (x >= 0 && x < XRES && y >= 0 && y < YRES) |
| 36 | { |
| 37 | if (sim->pmap[y][x] && ID(sim->pmap[y][x]) >= sim->debug_nextToUpdate) |
| 38 | { |
| 39 | i = ID(sim->pmap[y][x]); |
| 40 | } |
| 41 | else if (sim->photons[y][x] && ID(sim->photons[y][x]) >= sim->debug_nextToUpdate) |
| 42 | { |
| 43 | i = ID(sim->photons[y][x]); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | auto prevToUpdate = sim->debug_nextToUpdate; |
| 48 | model->SetQueuedFrames(1); |
| 49 | model->UpdateUpTo(i + 1); |
| 50 | if (sim->debug_nextToUpdate) |
| 51 | { |
| 52 | logmessage = String::Build("Updated particles from #", prevToUpdate, " through #", i); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | logmessage = String::Build("Updated particles from #", prevToUpdate, " to end"); |
| 57 | } |
| 58 | model->Log(logmessage, false); |
| 59 | } |
| 60 | |
| 61 | bool ParticleDebug::KeyPress(int key, int scan, bool shift, bool ctrl, bool alt, ui::Point currentMouse) |
| 62 | { |
nothing calls this directly
no test coverage detected