37 Commits
Author SHA1 Message Date
obligaron 22ec684671 Fix some MSVC warnings 2023-12-02 12:57:34 +01:00
obligaron 7cd7a3445f Remove global SetPiece Handling 2023-11-28 17:24:18 +01:00
obligaron 42e1b82a91 Use GetDunSize in loops 2023-11-28 17:24:18 +01:00
obligaron dc85e7db43 Introduce GetDunSize 2023-11-28 17:24:18 +01:00
Gleb Mazovetskiy 0d19c1b773 Slightly optimize loading same-sprite monsters
For monsters with the same sprite, load the sprite from the file system only once.

Example:

```
VERBOSE: Loaded monster graphics: falspear\phall   452 KiB   x1
VERBOSE: Loaded monster graphics: skelbow\sklbw    618 KiB   x1
VERBOSE: Loaded monster graphics: skelsd\sklsr     610 KiB   x1
VERBOSE: Loaded monster graphics: goatbow\goatb    832 KiB   x1
VERBOSE: Loaded monster graphics: bat\bat          282 KiB   x2 <-- here we only load the sprite once
VERBOSE: Loaded monster graphics: rhino\rhino     1306 KiB   x1
VERBOSE: Loaded monster graphics: golem\golem      298 KiB   x1
VERBOSE:  Total monster graphics:                 4401 KiB 4684 KiB
```

Here, the bat sprite will be loaded from the MPQ only once.
For the second sprite, we simply clone the first sprite before applying TRNs.

This also reduces the size of `MonsterData` from 88 bytes to 80.

When we migrate monster data to a TSV, the sprite IDs can be generated automatically at load time.
2023-11-10 06:01:40 +00:00
Gleb Mazovetskiy fa155d4ffd Dungeon tiles: Port over some cleanups from #6636 2023-09-23 18:02:43 +01:00
Gleb Mazovetskiy e5c426c315 Make IsWall easier for the compiler to inline
This appears to be a very hot function.
Makes it fully inlineable (even in Debug mode).
2023-09-18 21:26:13 +01:00
Gleb Mazovetskiy cf925d1edc Replace tuples with structs
Structs are more readable because the fields have names.
2023-09-13 13:47:47 +01:00
Gleb Mazovetskiy 74755c8be7 Remove utils/stdcompat/cstddef.hpp 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy 4fa3732526 Add missing <cstdint> includes
Done with the following script:

```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
  v = File.read(path)
  next if !v.include?("uint32_t") || v.include?("cstdint")

  lines = v.lines
  line_num = if lines[2].start_with?(" *")
    lines.index { |l| l.start_with?(" */") } + 3
  else
    3
  end

  lines.insert(line_num, "#include <cstdint>\n")

  File.write(path, lines.join(""))
end
```

then fixed-up manually
2023-05-10 13:50:12 +01:00
Anders Jenbo e969a8ad01 Invert player to vision relation 2023-04-21 21:25:19 +02:00
Anders Jenbo 382212b98c Remove DisableLighting from release builds 2023-04-21 21:25:19 +02:00
Anders Jenbo 779f16280c Consistently use uint8_t for lighting values 2023-04-18 23:53:04 +02:00
Gleb Mazovetskiy 38e37e0d53 Fix warnings/errors with -funsigned-char 2022-12-05 07:52:13 +01:00
Gleb Mazovetskiy 79b330825d dun_render: Avoid Invalid tile type
1. Do not call `RenderTile` with invalid values to begin with.
2. Move mask selection out of `RenderTile`.
2022-12-05 01:32:29 +01:00
Gleb Mazovetskiy b5f788cb33 trigs.cpp: Optimize & clean up the data structures
1. Use appropriate types.
2. Do not use an end marker for static arrays (their length is known).
2022-10-16 03:53:26 +01:00
Gleb Mazovetskiy 759ca7f055 WorldTileRectangle/Size
Adds a custom sized type for the world tile rectagle.

This allows us to better express intent.
It also allows us to make certain globals smaller, e.g. `THEME_LOC`.
2022-10-16 03:53:26 +01:00
obligaron 496689bb87 Fix incorrect SOLData for L1 arched/pillar Pieces (BlockLight and BlockMissile is missing) 2022-10-11 22:24:48 +02:00
obligaron f8a3212fba Fix incorrect SOLData for L1 Piece 27 (BlockMissile is missing) 2022-08-21 10:38:48 +02:00
Gleb Mazovetskiy 6327e713e0 Lowercase all file paths
We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).

This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).
2022-08-20 23:49:23 +01:00
obligaron a410e989bf Remove ScrollInfo 2022-08-03 21:25:21 +02:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
ephphatha e7708f44d9 Ensures that tests pass 2022-07-17 07:44:52 +02:00
Anders Jenbo bd175f1c53 Reduce double scans in GetSizeForThemeRoom
This takes it from 200% to just 110% tiles scanned during the processes
2022-07-17 07:44:52 +02:00
Anders Jenbo dd2644373d Use a single main loop in GetSizeForThemeRoom 2022-07-16 16:41:56 +02:00
Anders Jenbo 3f6e6b19db Restore optional optimization of GetSizeForThemeRoom
Looks like this improves performance by about 8%
2022-07-16 16:41:56 +02:00
Anders Jenbo 8d32782b12 Cleanup GetSizeForThemeRoom 2022-07-16 16:41:56 +02:00
ephphatha e8a50f104e Restore legacy behaviour
Ensures that tests pass
2022-07-16 10:32:12 +02:00
Andrew James 629fe1647a Fix incorrect size determination in GetSizeForThemeRoom (#4959)
This was a corner case where a boundary was determined by the edge of the search region. Not 100% sure it's correct in all cases, aiming to add some tests to try cover every possible case.
2022-07-11 16:04:47 +02:00
ephphatha 4802c0c8cf Split loops by phases
Hoping the comments make it easier to understand, I think this is what the intent was.
2022-07-10 05:52:58 +02:00
ephphatha 3812d75480 Use point/size for WillThemeRoomFit, rename to match use 2022-07-10 05:52:58 +02:00
ephphatha 7bb401d9e8 Simplify loop used to find the area for a theme room 2022-07-10 05:52:58 +02:00
ephphatha 420a248e0c Use FlipCoin for most uses of GenerateRnd with variable frequency 2022-07-10 02:37:33 +02:00
Anders Jenbo 8ed3cb476b Clean up initial room generation 2022-07-08 12:01:47 +02:00
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01:00
ephphatha c68fcf3cb1 Apply MethodCase config to Rectangle::Contains
Also included Circle and VirtualButton classes due to the shared use.
2022-06-24 00:39:55 +02:00
Anders Jenbo 6d56058708 Move level generation to subfolder 2022-06-23 09:21:58 +02:00