Skip to content

Conversation

@Corlyone
Copy link

Utility to edit the refreshable areas of the map

Animation18

For those people who have converted maps like Nostalrius 7.7 or want to add refreshable areas feature like in the original game

Utility to edit the refreshable areas of the map
@Tofame
Copy link

Tofame commented Aug 30, 2025

I don't know which approach is better - to use a bit in the tilestate like you did for refresh or if I would store in some humanly-readable format, the positions of tiles to be refreshed, so like some .json, .xml or whatever.

Any pros and cons in any of the approaches, opinions?

@Zbizu
Copy link
Member

Zbizu commented Oct 17, 2025

@Tofame
the mapeditor writes map flags as U32

if(save_tile->getMapFlags()) {
				f.addByte(OTBM_ATTR_TILE_FLAGS);
				f.addU32(save_tile->getMapFlags());
}

but the map flags are stored in 16 bit format

uint16_t mapFlags = tile->getMapFlags();

and in that u16, currently there are 12 bits in that are not even used, namely:

  • bit 2 (0x02)
  • tilestate_refresh - it's already present in rme code which means that the people who worked on otbm standard already had plans for it
  • 10 other bits after tilestate_refresh

which means that the standard zones can and should be placed on these bits

this is how I put them to use in my private fork:

	OTBM_TILEFLAG_NONE, // default
	OTBM_TILEFLAG_PROTECTIONZONE = 1 << 0, // protection zone
	OTBM_TILEFLAG_DEPRECATED = 1 << 1, // possibly former house tile
	OTBM_TILEFLAG_NOPVP = 1 << 2, // non-pvp zone
	OTBM_TILEFLAG_NOLOGOUT = 1 << 3, // no-logout area
	OTBM_TILEFLAG_PVPZONE = 1 << 4, // pvp zone
	OTBM_TILEFLAG_REFRESH = 1 << 5, // refresh tiles as in rl
	OTBM_TILEFLAG_RESTINGAREA = 1 << 6, // resting area (not necessarily PZ)
	OTBM_TILEFLAG_WALKTHROUGH = 1 << 7, // a special zone that allows walkthrough like PZ (except for special floors like depot tiles)
	OTBM_TILEFLAG_NOSUMMONS = 1 << 8, // area where summons are disallowed
	OTBM_TILEFLAG_UNREACHABLE = 1 << 9, // areas not reachable by player (eg. monsters behind teleports in tp room)

even after adding these zones, there are still two bytes that are not used
they could be used in the future to implement that other zone system.

@Corlyone Regarding your PR:
I haven't tested the changes, but if someone can confirm that it works, I don't see any issues with merging that because the enum is already present so it's a non-breaking change

only thing that bothers me is that the color looks too similar to house tile brush, I recommend a more distinct one, eg:

			// refresh area
			if (tileMapFlags & OTBM_TILEFLAG_REFRESH) {
				// dim blue 110, 145, 190
				r *= 0.43;
				g *= 0.56;
				b *= 0.75;
			}

here is what it looks like:
obraz

@Corlyone
Copy link
Author

Corlyone commented Nov 1, 2025

here is what it looks like: obraz

Community are welcome to implement any changes that think are good. I did the pull to see how "active" this community is, But from April to August... hmmm it took ages. I can add more pulls, for example, to improve the loading of maps (like 300MB maps loading in just 20 seconds), another like position paste related fixes. But if community as not active. How we can manage fixes for this. Greetings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants