Skip to content

LNZ parser#15

Draft
NullPainter2 wants to merge 2 commits intozivragon:mainfrom
NullPainter2:null-linez
Draft

LNZ parser#15
NullPainter2 wants to merge 2 commits intozivragon:mainfrom
NullPainter2:null-linez

Conversation

@NullPainter2
Copy link
Copy Markdown

Sorry for 2 previously closed pr. This one contains just the LNZ parsing stuff, so the integration can be done more easily.

@NullPainter2
Copy link
Copy Markdown
Author

NullPainter2 commented Jan 28, 2025

To load

		linezData.ParseFile("./Resource/linez/catmaster.lnz");
		linezData.ParseFile("./Resource/linez/calico-petz3.lnz");

Reason for that other file? The catmaster.lnz has some default values. Like Whiskers, which some cat's don't have customized.

@NullPainter2
Copy link
Copy Markdown
Author

NullPainter2 commented Jan 28, 2025

To handle Ommited ballz

if( linezData.IsBallOmmited( ballID )) 

This feature needs some extra work to add ... I tried different approach, but not adding Ball:Node2D to scene and marking it as ommited feels easier.

@NullPainter2
Copy link
Copy Markdown
Author

NullPainter2 commented Jan 28, 2025

To add addbalz:

  • addballz ID comes after the ballz. So it is 67 + addbal index
_Ready() {
                ...
		for (var index = 0; index < linezData.AddBallz.Count; index++)
		{
// get parent ball
			var addBallInfo = linezData.AddBallz[index];
			var parentBall = this.ballz[addBallInfo.ParentBallID];
			int addBallId = (int)catBhd.NumBallz + index;

/*
			if (linezData.IsBallOmmited(addBallId))
			{
				continue;
			}
*/
			Ball dummyBall = new Ball(
					texture, palette, (int)addBallInfo.BallSize, addBallInfo.Color, (int)addBallInfo.Fuzz,
					addBallInfo.Outline, addBallInfo.OutlineColor
				);

// position is = parent ball position + addball offset

			dummyBall.Position = parentBall.Position + new Vector2(addBallInfo.Offset.X, addBallInfo.Offset.Y);
			dummyBall.ZIndex = (int)-addBallInfo.Offset.Z;
			this.addBallz.Add(dummyBall);
			AddChild(dummyBall);
		}

_Render() {	

		foreach (var addBall in this.addBallz)
		{
// get the parent ball		
			Lnz.AddBall addBallInfo = GetAddballInfo(addBall.id);
// and its orientation			
			var orien = frame.BallOrientation(addBallInfo.ParentBallID);

// add the offset
			float xf = orien.Position.X + addBallInfo.Offset.X;
			float yf = orien.Position.Y + addBallInfo.Offset.Y;
			float zf = orien.Position.Z + addBallInfo.Offset.Z;
// ... rotate

@NullPainter2
Copy link
Copy Markdown
Author

NullPainter2 commented Jan 28, 2025

Whiskerz seem to be just linez ... I didn't figured out how to do their width yet.

hTrMQvXfNp

		foreach (var whisker in linezData.Whiskers)
		{
			// Either ball or add ball
			
			Ball startBall = GetBallByID( whisker.StartBallID );
			Ball endBall = GetBallByID( whisker.EndBallID );

			// omitted?
			
			if (startBall == null || endBall == null)
			{
				continue;
			}
			
			Line newLine = new Line(null, null, startBall,endBall,whisker.Color,1,-1,-1);

			//add them to the lists
			this.linez.Add(newLine);
			AddChild(newLine);
		}

zivragon added a commit that referenced this pull request Sep 14, 2025
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.

1 participant